From 95f6b49f3c881b7d4bd41cc5ab270514a282cb71 Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Thu, 20 Aug 2026 13:33:59 +0200 Subject: [PATCH 1/3] chore: bump the target engine to v1.0.0-beta.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Everything this repo ships is pinned to one engine release, so a bump moves four things together, and skipping any of them is silent: the vendored library sources, its generated bindings, the bundle built from them, and the Go generator. Re-vendored from the tag. beta.10 changes the library's introspector and its registry, and adds `agent` to the module-facing index.ts — the same export whose absence at beta.9 would have left modules unable to resolve it, caught again here by the check that every re-export exists in the bundle. The generator moved too, and three-way merged cleanly against our local changes: `@agent` support in the entrypoint, nullable objects gated on a beta.10 cutover, and the extendable-type list dropping Binding and Env. Left unsynced, that last one would have generated augmentations for types the engine no longer has. tsdistconsts is unchanged, so the typescript pin and bun image digest hold. sdk-sdk pins its own CLI release, which the workspace now overrides to match — otherwise its harness pairs our beta.10 library with a beta.9 engine and every scaffolded module fails to load. Signed-off-by: Tom Chauveau --- .dagger/modules/runtimes/main.dang | 13 +- dagger.toml | 4 + helpers/codegen/generator/functions.go | 15 + .../templates/entrypoint_functions.go | 3 + .../templates/entrypoint_typedef.go | 1 + .../typescript/templates/functions.go | 11 +- .../templates/src/_method_solve_body.ts.gtpl | 14 +- .../templates/src/method_solve.ts.gtpl | 2 +- .../typescript/templates/src/object_test.go | 33 + .../src/testdata/objects_test_want.ts | 15 +- helpers/codegen/introspection/filters.go | 4 +- library/bun.lock | 13 +- library/bundle/core.d.ts | 1528 ++-- library/bundle/core.js | 3027 +++++-- library/bundle/index.ts | 1 + library/bundle/introspector.js | 3377 ++++--- library/package.json | 13 +- library/src/api/client.gen.ts | 7786 +++++++---------- library/src/module/decorators.ts | 10 + library/src/module/entrypoint/register.ts | 4 + .../introspector/dagger_module/decorator.ts | 3 + .../introspector/dagger_module/function.ts | 7 + .../test/testdata/decorators/expected.json | 21 + .../test/testdata/decorators/index.ts | 10 +- .../src/module/introspector/typedef_json.ts | 1 + library/src/module/registry.ts | 16 + library/src/provisioning/default.ts | 2 +- library/yarn.lock | 50 +- 28 files changed, 8550 insertions(+), 7434 deletions(-) diff --git a/.dagger/modules/runtimes/main.dang b/.dagger/modules/runtimes/main.dang index df7c929..292f549 100644 --- a/.dagger/modules/runtimes/main.dang +++ b/.dagger/modules/runtimes/main.dang @@ -19,6 +19,12 @@ different interpreter, resolving @dagger.io/dagger a different way. type Runtimes { let fixtures: String! = ".dagger/modules/runtimes/fixtures" + """ + Engine release these tests run against, matching the version the vendored + library and committed bundle are built for. + """ + let engineVersion: String! = "1.0.0-beta.10" + """ A node module should generate and run. """ @@ -61,7 +67,12 @@ type Runtimes { and its default was applied. """ invokesFunctionCheck(ws: Workspace!): Void @check { - let target = sdkSdk.target(ws.directory("/"), ".") + # sdk-sdk pins its own CLI (1.0.0-beta.9), and the harness runs the whole + # user path through it. Our committed bundle is built for the engine this + # repo targets, so driving it with an older CLI pairs a beta.10 library with + # a beta.9 engine — the version coupling this SDK owns now that it ships the + # library. Pin the harness to the same engine instead. + let target = sdkSdk(daggerCliVersion: engineVersion).target(ws.directory("/"), ".") let run = target.run(["call", target.moduleName, "base-image-address"]) run.assertSuccess diff --git a/dagger.toml b/dagger.toml index 1a39d26..c2364f0 100644 --- a/dagger.toml +++ b/dagger.toml @@ -21,6 +21,10 @@ check.skip = ["*"] [modules.sdk-sdk] source = "github.com/dagger/sdk-sdk" +# The contract suite drives a real CLI through the whole user path. It pins its +# own release, which has to match the engine this SDK's committed bundle is +# built for — otherwise the checks pair our library with an older engine. +settings.daggerCliVersion = "1.0.0-beta.10" [modules.typescript-sdk.as-sdk] name = "typescript" diff --git a/helpers/codegen/generator/functions.go b/helpers/codegen/generator/functions.go index a7a0e0b..5877bf1 100644 --- a/helpers/codegen/generator/functions.go +++ b/helpers/codegen/generator/functions.go @@ -2,6 +2,7 @@ package generator import ( "fmt" + "regexp" "strings" "unicode" @@ -9,6 +10,10 @@ import ( "golang.org/x/mod/semver" ) +const nullableObjectSDKCutoverVersion = "v1.0.0-beta.10" + +var betaVersion = regexp.MustCompile(`^(v\d+\.\d+\.\d+-beta\.\d+)`) + const ( QueryStructName = "Query" QueryStructClientName = "Client" @@ -258,3 +263,13 @@ func (c *CommonFunctions) formatType(r *introspection.TypeRef, scope string, inp func (c *CommonFunctions) CheckVersionCompatibility(minVersion string) bool { return semver.Compare(c.schemaVersion, minVersion) >= 0 } + +func SupportsNullableObjects(schemaVersion string) bool { + if schemaVersion == "" || !semver.IsValid(schemaVersion) { + return true + } + if version := betaVersion.FindString(schemaVersion); version != "" { + schemaVersion = version + } + return semver.Compare(schemaVersion, nullableObjectSDKCutoverVersion) >= 0 +} diff --git a/helpers/codegen/generator/typescript/templates/entrypoint_functions.go b/helpers/codegen/generator/typescript/templates/entrypoint_functions.go index a0e3fa5..84b8e06 100644 --- a/helpers/codegen/generator/typescript/templates/entrypoint_functions.go +++ b/helpers/codegen/generator/typescript/templates/entrypoint_functions.go @@ -401,6 +401,9 @@ func (c *entrypointFuncCtx) renderFunctionExpr(fn *TypedefFunction) string { if fn.IsUp { parts = append(parts, ".withUp()") } + if fn.IsAgent { + parts = append(parts, ".withAgent()") + } return strings.Join(parts, "") } diff --git a/helpers/codegen/generator/typescript/templates/entrypoint_typedef.go b/helpers/codegen/generator/typescript/templates/entrypoint_typedef.go index 8ece612..83ccbb2 100644 --- a/helpers/codegen/generator/typescript/templates/entrypoint_typedef.go +++ b/helpers/codegen/generator/typescript/templates/entrypoint_typedef.go @@ -43,6 +43,7 @@ type TypedefFunction struct { IsCheck bool `json:"isCheck"` IsGenerator bool `json:"isGenerator"` IsUp bool `json:"isUp"` + IsAgent bool `json:"isAgent"` Location *TypedefLocation `json:"location,omitempty"` ReturnType *TypedefType `json:"returnType,omitempty"` Arguments []*TypedefArgument `json:"arguments"` diff --git a/helpers/codegen/generator/typescript/templates/functions.go b/helpers/codegen/generator/typescript/templates/functions.go index 889e448..a7b4a37 100644 --- a/helpers/codegen/generator/typescript/templates/functions.go +++ b/helpers/codegen/generator/typescript/templates/functions.go @@ -133,6 +133,7 @@ func (funcs typescriptTemplateFuncs) FuncMap() template.FuncMap { "IsSelfChainable": commonFunc.IsSelfChainable, "IsListOfObject": commonFunc.IsListOfObject, "IsListOfInterface": funcs.isListOfInterface, + "IsNullableObject": funcs.isNullableObject, "IsListOfEnum": commonFunc.IsListOfEnum, "GetArrayField": commonFunc.GetArrayField, "ToLowerCase": commonFunc.ToLowerCase, @@ -180,6 +181,10 @@ func (funcs typescriptTemplateFuncs) legacyTypeScriptSDKCompat() bool { return semver.Compare(funcs.schemaVersion, legacyTypeScriptSDKCompatCutoverVersion) < 0 } +func (funcs typescriptTemplateFuncs) supportsNullableObjects() bool { + return generator.SupportsNullableObjects(funcs.schemaVersion) +} + // isInterface checks if the type is a GraphQL interface. func (funcs typescriptTemplateFuncs) isInterface(t *introspection.Type) bool { return t.Kind == introspection.TypeKindInterface @@ -336,7 +341,11 @@ func (funcs typescriptTemplateFuncs) solve(field introspection.Field) bool { if field.TypeRef == nil { return false } - return field.TypeRef.IsScalar() || field.TypeRef.IsList() + return field.TypeRef.IsScalar() || field.TypeRef.IsList() || funcs.isNullableObject(field.TypeRef) +} + +func (funcs typescriptTemplateFuncs) isNullableObject(ref *introspection.TypeRef) bool { + return funcs.supportsNullableObjects() && ref != nil && ref.IsOptional() && (ref.IsObject() || ref.IsInterface()) } // subtract subtract integer a with integer b. diff --git a/helpers/codegen/generator/typescript/templates/src/_method_solve_body.ts.gtpl b/helpers/codegen/generator/typescript/templates/src/_method_solve_body.ts.gtpl index 4060d62..a540b5c 100644 --- a/helpers/codegen/generator/typescript/templates/src/_method_solve_body.ts.gtpl +++ b/helpers/codegen/generator/typescript/templates/src/_method_solve_body.ts.gtpl @@ -65,11 +65,21 @@ The dot is an introspection.Field. */ -}} {{- end }} ){{- /* Add subfields */ -}} {{- if and .TypeRef.IsList (IsListOfObject .TypeRef) }}.select("{{- range $i, $v := . | GetArrayField }}{{if $i }} {{ end }}{{ $v.Name | ToLowerCase }}{{- end }}") + {{- else if IsNullableObject .TypeRef }}.select("id") {{- end }} - {{ if not .TypeRef.IsVoid }}const response: Awaited<{{ if $convertID }}{{ . | FormatFieldOutputType }}{{ else }}{{ $promiseRetType }}{{ end }}> = {{ end }}await ctx.execute() + {{ if not .TypeRef.IsVoid }}const response: Awaited<{{ if IsNullableObject .TypeRef }}string | null{{ else if $convertID }}{{ . | FormatFieldOutputType }}{{ else }}{{ $promiseRetType }}{{ end }}> = {{ end }}await ctx.execute() - {{ if $convertID -}} + {{ if IsNullableObject .TypeRef -}} + if (response === null) { + return null + } + {{- if .TypeRef.IsInterface }} + return new _{{ $promiseRetType | FormatProtected | FormatName }}Client(ctx.copy().selectNode(response, "{{ $promiseRetType | FormatProtected }}")) + {{- else }} + return new {{ $promiseRetType | FormatProtected | FormatName }}(ctx.copy().selectNode(response, "{{ $promiseRetType | FormatProtected }}")) + {{- end }} + {{- else if $convertID -}} {{- if IsInterface .ParentObject }} return new _{{ $promiseRetType | FormatProtected | FormatName }}Client(ctx.copy().selectNode(response, "{{ $promiseRetType | FormatProtected }}")) {{- else }} diff --git a/helpers/codegen/generator/typescript/templates/src/method_solve.ts.gtpl b/helpers/codegen/generator/typescript/templates/src/method_solve.ts.gtpl index df98bc4..4df0ee6 100644 --- a/helpers/codegen/generator/typescript/templates/src/method_solve.ts.gtpl +++ b/helpers/codegen/generator/typescript/templates/src/method_solve.ts.gtpl @@ -29,7 +29,7 @@ {{- end }} {{- /* Write return type */ -}} - {{- "" }}): Promise<{{ if .TypeRef.IsVoid }}void{{ else }}{{ . | FormatFieldReturnType }}{{ end }}> => { {{- with .Directives.SourceMap }} // {{ .Module }} ({{ .Filelink | ModuleRelPath }}) {{- end }} + {{- "" }}): Promise<{{ if .TypeRef.IsVoid }}void{{ else }}{{ . | FormatFieldReturnType }}{{ if IsNullableObject .TypeRef }} | null{{ end }}{{ end }}> => { {{- with .Directives.SourceMap }} // {{ .Module }} ({{ .Filelink | ModuleRelPath }}) {{- end }} {{- /* Body is shared with the dep prototype augmentations. */ -}} {{- template "method_solve_body" . }} } diff --git a/helpers/codegen/generator/typescript/templates/src/object_test.go b/helpers/codegen/generator/typescript/templates/src/object_test.go index 455477b..f360ffb 100644 --- a/helpers/codegen/generator/typescript/templates/src/object_test.go +++ b/helpers/codegen/generator/typescript/templates/src/object_test.go @@ -83,6 +83,39 @@ func TestObjectFieldDeprecated(t *testing.T) { require.Equal(t, want, b.String()) } +func TestNullableObjectField(t *testing.T) { + object := objectInit(t, `{ + "kind": "OBJECT", + "name": "GitRepository", + "description": "", + "fields": [{ + "args": [], + "description": "", + "isDeprecated": false, + "name": "latestVersion", + "type": {"kind": "OBJECT", "name": "GitRef"} + }], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }`) + + tmpl := templateHelper(t) + var b bytes.Buffer + require.NoError(t, tmpl.ExecuteTemplate(&b, "object", object)) + require.Contains(t, b.String(), "latestVersion = async (): Promise") + require.Contains(t, b.String(), `"latestVersion",`) + require.Contains(t, b.String(), `.select("id")`) + require.Contains(t, b.String(), "if (response === null)") + + tmpl = templates.New("v1.0.0-beta.9", nil, "", generator.Config{}) + b.Reset() + require.NoError(t, tmpl.ExecuteTemplate(&b, "object", object)) + require.Contains(t, b.String(), "latestVersion = (): GitRef") + require.NotContains(t, b.String(), "response === null") +} + func TestInterfaceMethodOptionalArgDeprecated(t *testing.T) { tmpl := templateHelper(t) diff --git a/helpers/codegen/generator/typescript/templates/src/testdata/objects_test_want.ts b/helpers/codegen/generator/typescript/templates/src/testdata/objects_test_want.ts index 1766fda..9c2c661 100644 --- a/helpers/codegen/generator/typescript/templates/src/testdata/objects_test_want.ts +++ b/helpers/codegen/generator/typescript/templates/src/testdata/objects_test_want.ts @@ -62,13 +62,18 @@ export class Host extends BaseClient { /** * Lookup the value of an environment variable. Null if the variable is not available. */ - envVariable = (name: string): HostVariable => { - + envVariable = async (name: string): Promise => { const ctx = this._ctx.select( "envVariable", - { name }, - ) - return new HostVariable(ctx) + { name}, + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new HostVariable(ctx.copy().selectNode(response, "HostVariable")) } /** diff --git a/helpers/codegen/introspection/filters.go b/helpers/codegen/introspection/filters.go index 75952ab..87ec54f 100644 --- a/helpers/codegen/introspection/filters.go +++ b/helpers/codegen/introspection/filters.go @@ -6,13 +6,11 @@ import "slices" // installing a dependency. var ExtendableTypes = []string{ "Query", - "Binding", - "Env", } // DependencyNames returns the unique list of module names that appear in // the schema's sourceMap directives, excluding the built-in extendable types -// (Query, Binding, Env) whose fields are contributed by multiple modules. +// (Query) whose fields are contributed by multiple modules. func (s *Schema) DependencyNames() []string { seen := map[string]struct{}{} var names []string diff --git a/library/bun.lock b/library/bun.lock index 8ab4ee4..d3886b5 100644 --- a/library/bun.lock +++ b/library/bun.lock @@ -14,7 +14,7 @@ "@opentelemetry/sdk-metrics": "^2.8.0", "@opentelemetry/sdk-node": "^0.219.0", "@opentelemetry/semantic-conventions": "^1.41.1", - "adm-zip": "^0.5.18", + "adm-zip": "^0.6.0", "env-paths": "^4.0.0", "execa": "^9.6.1", "graphql": "^17.0.1", @@ -40,6 +40,7 @@ }, "overrides": { "@grpc/grpc-js": "1.14.4", + "@opentelemetry/propagator-jaeger": "2.9.0", "form-data": "4.0.6", }, "packages": { @@ -117,7 +118,7 @@ "@opentelemetry/propagator-b3": ["@opentelemetry/propagator-b3@2.8.0", "", { "dependencies": { "@opentelemetry/core": "2.8.0" } }, "sha512-SazlvuSKi5533rPHTW2TwBwdMakhjZST4SYs0YauuvfGDkT13KbG1gJS75hV0uWVeevhtVP9sAIlaZLTHdSbMg=="], - "@opentelemetry/propagator-jaeger": ["@opentelemetry/propagator-jaeger@2.8.0", "", { "dependencies": { "@opentelemetry/core": "2.8.0" } }, "sha512-Xnz9zZvvQzUw+9DrOn0MomR7BxFCkA2pcfXBQuHC28ndJpSbjLs7knzYb05kw5SyCjSsEWombkZMgGcJSk8JVg=="], + "@opentelemetry/propagator-jaeger": ["@opentelemetry/propagator-jaeger@2.9.0", "", { "dependencies": { "@opentelemetry/core": "2.9.0" } }, "sha512-4mYGty27rYvSM0jtp1ZUOqd3LfVRCYg9H5G9OFzSx5HViYToU21MFhWfco7x1HwXr7ER8yGOiCIHZUwjPksc0Q=="], "@opentelemetry/resources": ["@opentelemetry/resources@2.8.0", "", { "dependencies": { "@opentelemetry/core": "2.8.0", "@opentelemetry/semantic-conventions": "^1.29.0" } }, "sha512-qmXQ27ilDbUK/vGMqwL8D4/rhn76C+sherM4wTbjlfknR8Nvfc/hCxjRJPhkzZzUsPiNg16SA31NxMabwttRjg=="], @@ -235,7 +236,7 @@ "acorn-walk": ["acorn-walk@https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw=="], - "adm-zip": ["adm-zip@0.5.18", "", {}, "sha512-ufJnssQGbxzLNS1Ho9bCtX4rQKCCvoVuDLHoJyc3F9dOGDB4BkWs2Ci0kv53lqocAEQ/Cbi+I2XCsNYGqVYqng=="], + "adm-zip": ["adm-zip@0.6.0", "", {}, "sha512-XleryMhbuksdKtofnWZ9Sk+4CUTbms4Mb/EU32SZwToAyZ5RgVos/ki8n+yr0LWHOGKuakbXTuuYNHLQjhddgg=="], "ansi-color": ["ansi-color@https://registry.npmjs.org/ansi-color/-/ansi-color-0.2.1.tgz", {}, "sha512-bF6xLaZBLpOQzgYUtYEhJx090nPSZk1BQ/q2oyBK9aMMcJHzx9uXGCjI2Y+LebsN4Jwoykr0V9whbPiogdyHoQ=="], @@ -251,7 +252,7 @@ "balanced-match": ["balanced-match@https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], - "brace-expansion": ["brace-expansion@2.1.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA=="], + "brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="], "browser-stdout": ["browser-stdout@https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", {}, "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw=="], @@ -389,7 +390,7 @@ "js-tokens": ["js-tokens@https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "js-yaml": ["js-yaml@https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", { "dependencies": { "argparse": "^2.0.1" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="], + "js-yaml": ["js-yaml@4.3.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ=="], "locate-path": ["locate-path@https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], @@ -553,6 +554,8 @@ "@isaacs/cliui/wrap-ansi": ["wrap-ansi@https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], + "@opentelemetry/propagator-jaeger/@opentelemetry/core": ["@opentelemetry/core@2.9.0", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" } }, "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw=="], + "chalk/supports-color": ["supports-color@https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], "es-set-tostringtag/hasown": ["hasown@https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], diff --git a/library/bundle/core.d.ts b/library/bundle/core.d.ts index 36d9e1a..87742ff 100644 --- a/library/bundle/core.d.ts +++ b/library/bundle/core.d.ts @@ -115,6 +115,12 @@ type AddressFileOpts = { gitignore?: boolean; noCache?: boolean; }; +type AgentGroupComposeOpts = { + /** + * The base LLM to compose onto. Defaults to a fresh workspace-bound LLM. + */ + base?: LLM; +}; type BuildArg = { /** * The build argument name. @@ -881,12 +887,6 @@ type ContainerWithoutUnixSocketOpts = { */ expand?: boolean; }; -type CurrentModuleAsSdkOpts = { - /** - * The workspace to resolve SDK-role data against. Defaults to the current workspace. - */ - workspace?: Workspace; -}; type CurrentModuleGeneratorsOpts = { /** * Only include generators matching the specified patterns @@ -1162,12 +1162,24 @@ type DirectoryWithNewFileOpts = { */ permissions?: number; }; +type DirectoryWithPatchOpts = { + /** + * How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + */ + onConflict?: PatchConflict; +}; +type DirectoryWithPatchFileOpts = { + /** + * How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + */ + onConflict?: PatchConflict; +}; type EngineCacheEntrySetOpts = { key?: string; }; type EngineCachePruneOpts = { /** - * Use the engine-wide default pruning policy if true, otherwise prune the whole cache of any releasable entries. + * Use enabled engine-wide default disk and structural policies. If no default disk policy is enabled, the disk stage falls back to pruning all releasable disk-cache entries. If false, explicit options select stages; with no options, all releasable disk-cache entries are pruned. */ useDefaultPolicy?: boolean; /** @@ -1186,22 +1198,14 @@ type EngineCachePruneOpts = { * Override the target disk space to keep after pruning (e.g. "200GB" or "50%"). */ targetSpace?: string; -}; -type EnvChecksOpts = { - /** - * Only include checks matching the specified patterns - */ - include?: string[]; /** - * When true, only return annotated check functions; exclude generate-as-checks + * Override the maximum structural metadata estimate in absolute bytes. Explicit values must be positive; the configured/default value is used when omitted. */ - noGenerate?: boolean; -}; -type EnvServicesOpts = { + maxEstimatedBytes?: number; /** - * Only include services matching the specified patterns + * Override the structural metadata estimate to target in absolute bytes. Explicit values must be positive and lower than the resolved maximum; the configured/default value is used when omitted. */ - include?: string[]; + targetEstimatedBytes?: number; }; type EnvFileGetOpts = { /** @@ -1424,12 +1428,52 @@ type GeneratorGroupChangesOpts = { */ onConflict?: ChangesetsMergeConflict; }; +type GitCommitAncestorReleaseTagOpts = { + /** + * Include pre-release tags when choosing the latest tag. + */ + includePreRelease?: boolean; +}; +type GitCommitReleaseTagOpts = { + /** + * Include pre-release tags when choosing the latest tag. + */ + includePreRelease?: boolean; +}; +type GitCommitTreeOpts = { + /** + * Set to true to discard .git directory. + */ + discardGitDir?: boolean; + /** + * The depth of the tree to fetch. + */ + depth?: number; + /** + * Set to true to populate tag refs in the local checkout .git. + */ + includeTags?: boolean; +}; type GitRefAsWorkspaceOpts = { /** * Current working directory inside the workspace root. Defaults to the workspace root. */ cwd?: string; }; +type GitRefLogOpts = { + /** + * Maximum number of commits to return. + */ + limit?: number; + /** + * Only include commits touching these paths, relative to the root of the repository. + */ + paths?: string[]; + /** + * Exclude commits reachable from this ref, i.e. only list commits added on top of it. + */ + base?: GitRef; +}; type GitRefTreeOpts = { /** * Set to true to discard .git directory. @@ -1618,6 +1662,12 @@ type LLMWithResponseOpts = { */ totalTokens?: number; }; +type LLMWithToolsOpts = { + /** + * Method names to exclude from the toolset (e.g. constructors, entrypoints). + */ + except?: string[]; +}; type LLMContentBlockInput = { /** * The arguments to pass to the tool (for TOOL_CALL kind). @@ -1795,6 +1845,29 @@ declare function NetworkProtocolValueToName(value: NetworkProtocol): string; * it can be properly used inside the module runtime. */ declare function NetworkProtocolNameToValue(name: string): NetworkProtocol; +/** + * How to handle patch hunks that no longer apply to the target content. + */ +declare enum PatchConflict { + /** + * Fail the operation if any part of the patch does not apply. + */ + Fail = "FAIL", + /** + * Apply the hunks that fit and insert conflict markers where hunks no longer match, instead of failing. + */ + LeaveConflictMarkers = "LEAVE_CONFLICT_MARKERS" +} +/** + * Utility function to convert a PatchConflict value to its name so + * it can be uses as argument to call a exposed function. + */ +declare function PatchConflictValueToName(value: PatchConflict): string; +/** + * Utility function to convert a PatchConflict name to its value so + * it can be properly used inside the module runtime. + */ +declare function PatchConflictNameToValue(name: string): PatchConflict; type PipelineLabel = { /** * Label name. @@ -1863,15 +1936,11 @@ type ClientCurrentTypeDefsOpts = { */ hideCore?: boolean; }; -type ClientEnvOpts = { - /** - * Give the environment the same privileges as the caller: core API including host access, current module, and dependencies - */ - privileged?: boolean; +type ClientEngineVolumeOpts = { /** - * Allow new outputs to be declared and saved in the environment + * Optional existing subdirectory within the volume payload to mount. */ - writable?: boolean; + subdir?: string; }; type ClientEnvFileOpts = { /** @@ -2271,6 +2340,18 @@ declare function TypeDefKindNameToValue(name: string): TypeDefKind; type Void = string & { __Void: never; }; +type WorkspaceAgentsOpts = { + /** + * Only include agents matching the specified patterns + */ + include?: string[]; +}; +type WorkspaceChangesOpts = { + /** + * An earlier workspace state to compare against. + */ + from?: Workspace; +}; type WorkspaceChecksOpts = { /** * Only include checks matching the specified patterns @@ -2309,6 +2390,20 @@ type WorkspaceDirectoryOpts = { */ gitignore?: boolean; }; +type WorkspaceFindRootsOpts = { + /** + * Directory to start from. Relative paths resolve from the workspace cwd. + */ + start?: string; + /** + * File basenames that mark a project root (e.g. ["go.mod"] or ["deno.json", "deno.jsonc"]). + */ + markers: string[]; + /** + * Glob patterns pruning the walk below start (e.g. ["**\/node_modules/**"]). + */ + exclude?: string[]; +}; type WorkspaceFindUpOpts = { /** * Path to start the search from. Relative paths resolve from the workspace cwd; absolute paths resolve from the workspace root. @@ -2398,10 +2493,14 @@ type WorkspaceWithInitClientOpts = { * Write to the workspace config directory at the workspace cwd. */ here?: boolean; + /** + * Skip running the SDK's generators for the new client. + */ + noGenerate?: boolean; }; type WorkspaceWithInitModuleOpts = { /** - * Workspace-relative path for the new module. + * Path for the new module, relative to the workspace cwd; a leading "/" is relative to the workspace root. Defaults to .dagger/modules/ beside the workspace config. */ path?: string; /** @@ -2420,6 +2519,10 @@ type WorkspaceWithInitModuleOpts = { * Write to the workspace config directory at the workspace cwd. */ here?: boolean; + /** + * Skip running the SDK's generators for the new module. + */ + noGenerate?: boolean; }; type WorkspaceWithModuleOpts = { /** @@ -2545,213 +2648,54 @@ declare class Address extends BaseClient { */ volume: () => Volume; } -declare class Binding extends BaseClient { +declare class Agent extends BaseClient { private readonly _id?; - private readonly _asString?; - private readonly _digest?; - private readonly _isNull?; + private readonly _description?; private readonly _name?; - private readonly _typeName?; /** * Constructor is used for internal usage only, do not create object from it. */ - constructor(ctx?: Context, _id?: ID, _asString?: string, _digest?: string, _isNull?: boolean, _name?: string, _typeName?: string); + constructor(ctx?: Context, _id?: ID, _description?: string, _name?: string); /** - * A unique identifier for this Binding. + * A unique identifier for this Agent. */ id: () => Promise; /** - * Retrieve the binding value, as type Address - */ - asAddress: () => Address; - /** - * Retrieve the binding value, as type CacheVolume - */ - asCacheVolume: () => CacheVolume; - /** - * Retrieve the binding value, as type Changeset - */ - asChangeset: () => Changeset; - /** - * Retrieve the binding value, as type Check - */ - asCheck: () => Check; - /** - * Retrieve the binding value, as type CheckGroup - */ - asCheckGroup: () => CheckGroup; - /** - * Retrieve the binding value, as type Cloud - */ - asCloud: () => Cloud; - /** - * Retrieve the binding value, as type Container - */ - asContainer: () => Container; - /** - * Retrieve the binding value, as type CurrentModuleAsSDK - */ - asCurrentModuleAsSDK: () => CurrentModuleAsSDK; - /** - * Retrieve the binding value, as type CurrentModuleAsSDKClient - */ - asCurrentModuleAsSDKClient: () => CurrentModuleAsSDKClient; - /** - * Retrieve the binding value, as type CurrentModuleAsSDKModule - */ - asCurrentModuleAsSDKModule: () => CurrentModuleAsSDKModule; - /** - * Retrieve the binding value, as type DiffStat - */ - asDiffStat: () => DiffStat; - /** - * Retrieve the binding value, as type Directory - */ - asDirectory: () => Directory; - /** - * Retrieve the binding value, as type Env - */ - asEnv: () => Env; - /** - * Retrieve the binding value, as type EnvFile - */ - asEnvFile: () => EnvFile; - /** - * Retrieve the binding value, as type File - */ - asFile: () => File; - /** - * Retrieve the binding value, as type Generator - */ - asGenerator: () => Generator; - /** - * Retrieve the binding value, as type GeneratorGroup - */ - asGeneratorGroup: () => GeneratorGroup; - /** - * Retrieve the binding value, as type GitRef - */ - asGitRef: () => GitRef; - /** - * Retrieve the binding value, as type GitRepository - */ - asGitRepository: () => GitRepository; - /** - * Retrieve the binding value, as type HTTPState - */ - asHTTPState: () => HTTPState; - /** - * Retrieve the binding value, as type JSONValue - */ - asJSONValue: () => JSONValue; - /** - * Retrieve the binding value, as type LLMContentBlock - */ - asLLMContentBlock: () => LLMContentBlock; - /** - * Retrieve the binding value, as type LLMMessage - */ - asLLMMessage: () => LLMMessage; - /** - * Retrieve the binding value, as type Module - */ - asModule: () => Module_; - /** - * Retrieve the binding value, as type ModuleConfigClient - */ - asModuleConfigClient: () => ModuleConfigClient; - /** - * Retrieve the binding value, as type ModuleSource - */ - asModuleSource: () => ModuleSource; - /** - * Retrieve the binding value, as type Schema - */ - asSchema: () => Schema; - /** - * Retrieve the binding value, as type SearchResult - */ - asSearchResult: () => SearchResult; - /** - * Retrieve the binding value, as type SearchSubmatch - */ - asSearchSubmatch: () => SearchSubmatch; - /** - * Retrieve the binding value, as type Secret - */ - asSecret: () => Secret; - /** - * Retrieve the binding value, as type Service - */ - asService: () => Service; - /** - * Retrieve the binding value, as type Socket - */ - asSocket: () => Socket; - /** - * Retrieve the binding value, as type Stat + * The description of the agent */ - asStat: () => Stat; - /** - * Returns the binding's string value - */ - asString: () => Promise; - /** - * Retrieve the binding value, as type Up - */ - asUp: () => Up; - /** - * Retrieve the binding value, as type UpGroup - */ - asUpGroup: () => UpGroup; - /** - * Retrieve the binding value, as type Volume - */ - asVolume: () => Volume; - /** - * Retrieve the binding value, as type Workspace - */ - asWorkspace: () => Workspace; - /** - * Retrieve the binding value, as type WorkspaceGit - */ - asWorkspaceGit: () => WorkspaceGit; - /** - * Retrieve the binding value, as type WorkspaceMigration - */ - asWorkspaceMigration: () => WorkspaceMigration; - /** - * Retrieve the binding value, as type WorkspaceMigrationStep - */ - asWorkspaceMigrationStep: () => WorkspaceMigrationStep; + description: () => Promise; /** - * Retrieve the binding value, as type WorkspaceModule + * Return the fully qualified name of the agent */ - asWorkspaceModule: () => WorkspaceModule; + name: () => Promise; /** - * Retrieve the binding value, as type WorkspaceModuleSetting + * The original module in which the agent has been defined */ - asWorkspaceModuleSetting: () => WorkspaceModuleSetting; + originalModule: () => Module_; /** - * Retrieve the binding value, as type WorkspaceSDK + * The path of the agent within its module */ - asWorkspaceSDK: () => WorkspaceSDK; + path: () => Promise; +} +declare class AgentGroup extends BaseClient { + private readonly _id?; /** - * Returns the digest of the binding value + * Constructor is used for internal usage only, do not create object from it. */ - digest: () => Promise; + constructor(ctx?: Context, _id?: ID); /** - * Returns true if the binding is null + * A unique identifier for this AgentGroup. */ - isNull: () => Promise; + id: () => Promise; /** - * Returns the binding name + * Compose all selected agent middlewares onto a base LLM, in alphabetical module:fn order, and return the composed LLM. + * @param opts.base The base LLM to compose onto. Defaults to a fresh workspace-bound LLM. */ - name: () => Promise; + compose: (opts?: AgentGroupComposeOpts) => LLM; /** - * Returns the binding type + * Return a list of individual agents and their details */ - typeName: () => Promise; + list: () => Promise; } /** * A directory whose contents persist across runs. @@ -2884,7 +2828,7 @@ declare class Check extends BaseClient { /** * If the check failed, this is the error */ - error: () => Error$1; + error: () => Promise; /** * Return the fully qualified name of the check */ @@ -3058,7 +3002,7 @@ declare class Container extends BaseClient { /** * Retrieves this container's configured docker healthcheck. */ - dockerHealthcheck: () => HealthcheckConfig; + dockerHealthcheck: () => Promise; /** * Return the container's OCI entrypoint. */ @@ -3240,7 +3184,7 @@ declare class Container extends BaseClient { * @param path Path to check (e.g., "/file.txt"). * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. */ - stat: (path: string, opts?: ContainerStatOpts) => Stat; + stat: (path: string, opts?: ContainerStatOpts) => Promise; /** * The buffered standard error stream of the last executed command * @@ -3709,9 +3653,9 @@ declare class CurrentModule extends BaseClient { * Treat the currently executing module as an SDK installed in the given workspace, exposing the modules and clients it manages. * * Errors if the current module is not installed as an SDK in this workspace. - * @param opts.workspace The workspace to resolve SDK-role data against. Defaults to the current workspace. + * @param workspace The workspace to resolve SDK-role data against. */ - asSDK: (opts?: CurrentModuleAsSdkOpts) => CurrentModuleAsSDK; + asSDK: (workspace: Workspace) => CurrentModuleAsSDK; /** * The dependencies of the module. */ @@ -3749,7 +3693,7 @@ declare class CurrentModule extends BaseClient { workdirFile: (path: string) => File; } /** - * The SDK-role data for the currently executing module, as installed in the active workspace. + * The SDK-role data for the currently executing module, as installed in the supplied workspace. */ declare class CurrentModuleAsSDK extends BaseClient { private readonly _id?; @@ -3767,7 +3711,7 @@ declare class CurrentModuleAsSDK extends BaseClient { */ clients: () => Promise; /** - * The workspace-local modules this SDK authors and manages. + * The managed modules relevant to the bound workspace cwd: every module at or below it, plus the nearest enclosing module when the cwd itself is not managed. */ modules: () => Promise; /** @@ -4022,7 +3966,7 @@ declare class Directory extends BaseClient { * @param path Path to stat (e.g., "/file.txt"). * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. */ - stat: (path: string, opts?: DirectoryStatOpts) => Stat; + stat: (path: string, opts?: DirectoryStatOpts) => Promise; /** * Force evaluation in the engine. */ @@ -4095,15 +4039,17 @@ declare class Directory extends BaseClient { /** * Retrieves this directory with the given Git-compatible patch applied. * @param patch Patch to apply (e.g., "diff --git a/file.txt b/file.txt\nindex 1234567..abcdef8 100644\n--- a/file.txt\n+++ b/file.txt\n@@ -1,1 +1,1 @@\n-Hello\n+World\n"). + * @param opts.onConflict How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. * @experimental */ - withPatch: (patch: string) => Directory; + withPatch: (patch: string, opts?: DirectoryWithPatchOpts) => Directory; /** * Retrieves this directory with the given Git-compatible patch file applied. * @param patch File containing the patch to apply + * @param opts.onConflict How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. * @experimental */ - withPatchFile: (patch: File) => Directory; + withPatchFile: (patch: File, opts?: DirectoryWithPatchFileOpts) => Directory; /** * Return a snapshot with a symlink * @param target Location of the file or directory to link to (e.g., "/existing/file"). @@ -4198,11 +4144,13 @@ declare class EngineCache extends BaseClient { minFreeSpace: () => Promise; /** * Prune the cache of releaseable entries - * @param opts.useDefaultPolicy Use the engine-wide default pruning policy if true, otherwise prune the whole cache of any releasable entries. + * @param opts.useDefaultPolicy Use enabled engine-wide default disk and structural policies. If no default disk policy is enabled, the disk stage falls back to pruning all releasable disk-cache entries. If false, explicit options select stages; with no options, all releasable disk-cache entries are pruned. * @param opts.maxUsedSpace Override the maximum disk space to keep before pruning (e.g. "200GB" or "80%"). * @param opts.reservedSpace Override the minimum disk space to retain during pruning (e.g. "500GB" or "10%"). * @param opts.minFreeSpace Override the minimum free disk space target during pruning (e.g. "20GB" or "20%"). * @param opts.targetSpace Override the target disk space to keep after pruning (e.g. "200GB" or "50%"). + * @param opts.maxEstimatedBytes Override the maximum structural metadata estimate in absolute bytes. Explicit values must be positive; the configured/default value is used when omitted. + * @param opts.targetEstimatedBytes Override the structural metadata estimate to target in absolute bytes. Explicit values must be positive and lower than the resolved maximum; the configured/default value is used when omitted. */ prune: (opts?: EngineCachePruneOpts) => Promise; /** @@ -4326,7 +4274,7 @@ declare class EnumTypeDef extends BaseClient { /** * The location of this enum declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * If this EnumTypeDef is associated with a Module, the name of the module. Unset otherwise. */ @@ -4369,760 +4317,107 @@ declare class EnumValueTypeDef extends BaseClient { /** * The location of this enum member declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * The value of the enum member */ value: () => Promise; } -declare class Env extends BaseClient { +/** + * A collection of environment variables. + */ +declare class EnvFile extends BaseClient { private readonly _id?; + private readonly _exists?; + private readonly _get?; /** * Constructor is used for internal usage only, do not create object from it. */ - constructor(ctx?: Context, _id?: ID); + constructor(ctx?: Context, _id?: ID, _exists?: boolean, _get?: string); /** - * A unique identifier for this Env. + * A unique identifier for this EnvFile. */ id: () => Promise; /** - * Return the check with the given name from the installed modules. Must match exactly one check. - * @param name The name of the check to retrieve - * @experimental + * Return as a file */ - check: (name: string) => Check; + asFile: () => File; /** - * Return all checks defined by the installed modules - * @param opts.include Only include checks matching the specified patterns - * @param opts.noGenerate When true, only return annotated check functions; exclude generate-as-checks - * @experimental + * Check if a variable exists + * @param name Variable name */ - checks: (opts?: EnvChecksOpts) => CheckGroup; + exists: (name: string) => Promise; /** - * Retrieves an input binding by name + * Lookup a variable (last occurrence wins) and return its value, or an empty string + * @param name Variable name + * @param opts.raw Return the value exactly as written to the file. No quote removal or variable expansion */ - input: (name: string) => Binding; + get: (name: string, opts?: EnvFileGetOpts) => Promise; /** - * Returns all input bindings provided to the environment + * Filters variables by prefix and removes the pref from keys. Variables without the prefix are excluded. For example, with the prefix "MY_APP_" and variables: MY_APP_TOKEN=topsecret MY_APP_NAME=hello FOO=bar the resulting environment will contain: TOKEN=topsecret NAME=hello + * @param prefix The prefix to filter by */ - inputs: () => Promise; + namespace_: (prefix: string) => EnvFile; /** - * Retrieves an output binding by name + * Return all variables + * @param opts.raw Return values exactly as written to the file. No quote removal or variable expansion */ - output: (name: string) => Binding; + variables: (opts?: EnvFileVariablesOpts) => Promise; /** - * Returns all declared output bindings for the environment + * Add a variable + * @param name Variable name + * @param value Variable value */ - outputs: () => Promise; + withVariable: (name: string, value: string) => EnvFile; /** - * Return all services defined by the installed modules - * @param opts.include Only include services matching the specified patterns - * @experimental + * Remove all occurrences of the named variable + * @param name Variable name */ - services: (opts?: EnvServicesOpts) => UpGroup; + withoutVariable: (name: string) => EnvFile; /** - * Create or update a binding of type Address in the environment - * @param name The name of the binding - * @param value The Address value to assign to the binding - * @param description The purpose of the input + * Call the provided function with current EnvFile. + * + * This is useful for reusability and readability by not breaking the calling chain. */ - withAddressInput: (name: string, value: Address, description: string) => Env; + with: (arg: (param: EnvFile) => EnvFile) => EnvFile; +} +/** + * An environment variable name and value. + */ +declare class EnvVariable extends BaseClient { + private readonly _id?; + private readonly _name?; + private readonly _value?; /** - * Declare a desired Address output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withAddressOutput: (name: string, description: string) => Env; + constructor(ctx?: Context, _id?: ID, _name?: string, _value?: string); /** - * Create or update a binding of type CacheVolume in the environment - * @param name The name of the binding - * @param value The CacheVolume value to assign to the binding - * @param description The purpose of the input + * A unique identifier for this EnvVariable. */ - withCacheVolumeInput: (name: string, value: CacheVolume, description: string) => Env; + id: () => Promise; /** - * Declare a desired CacheVolume output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The environment variable name. */ - withCacheVolumeOutput: (name: string, description: string) => Env; + name: () => Promise; /** - * Create or update a binding of type Changeset in the environment - * @param name The name of the binding - * @param value The Changeset value to assign to the binding - * @param description The purpose of the input + * The environment variable value. */ - withChangesetInput: (name: string, value: Changeset, description: string) => Env; + value: () => Promise; +} +declare class Error$1 extends BaseClient { + private readonly _id?; + private readonly _message?; /** - * Declare a desired Changeset output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withChangesetOutput: (name: string, description: string) => Env; + constructor(ctx?: Context, _id?: ID, _message?: string); /** - * Create or update a binding of type CheckGroup in the environment - * @param name The name of the binding - * @param value The CheckGroup value to assign to the binding - * @param description The purpose of the input + * A unique identifier for this Error. */ - withCheckGroupInput: (name: string, value: CheckGroup, description: string) => Env; + id: () => Promise; /** - * Declare a desired CheckGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCheckGroupOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Check in the environment - * @param name The name of the binding - * @param value The Check value to assign to the binding - * @param description The purpose of the input - */ - withCheckInput: (name: string, value: Check, description: string) => Env; - /** - * Declare a desired Check output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCheckOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Cloud in the environment - * @param name The name of the binding - * @param value The Cloud value to assign to the binding - * @param description The purpose of the input - */ - withCloudInput: (name: string, value: Cloud, description: string) => Env; - /** - * Declare a desired Cloud output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCloudOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Container in the environment - * @param name The name of the binding - * @param value The Container value to assign to the binding - * @param description The purpose of the input - */ - withContainerInput: (name: string, value: Container, description: string) => Env; - /** - * Declare a desired Container output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withContainerOutput: (name: string, description: string) => Env; - /** - * Installs the current module into the environment, exposing its functions to the model - * - * Contextual path arguments will be populated using the environment's workspace. - */ - withCurrentModule: () => Env; - /** - * Create or update a binding of type CurrentModuleAsSDKClient in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDKClient value to assign to the binding - * @param description The purpose of the input - */ - withCurrentModuleAsSDKClientInput: (name: string, value: CurrentModuleAsSDKClient, description: string) => Env; - /** - * Declare a desired CurrentModuleAsSDKClient output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCurrentModuleAsSDKClientOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type CurrentModuleAsSDK in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDK value to assign to the binding - * @param description The purpose of the input - */ - withCurrentModuleAsSDKInput: (name: string, value: CurrentModuleAsSDK, description: string) => Env; - /** - * Create or update a binding of type CurrentModuleAsSDKModule in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDKModule value to assign to the binding - * @param description The purpose of the input - */ - withCurrentModuleAsSDKModuleInput: (name: string, value: CurrentModuleAsSDKModule, description: string) => Env; - /** - * Declare a desired CurrentModuleAsSDKModule output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCurrentModuleAsSDKModuleOutput: (name: string, description: string) => Env; - /** - * Declare a desired CurrentModuleAsSDK output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withCurrentModuleAsSDKOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type DiffStat in the environment - * @param name The name of the binding - * @param value The DiffStat value to assign to the binding - * @param description The purpose of the input - */ - withDiffStatInput: (name: string, value: DiffStat, description: string) => Env; - /** - * Declare a desired DiffStat output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withDiffStatOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Directory in the environment - * @param name The name of the binding - * @param value The Directory value to assign to the binding - * @param description The purpose of the input - */ - withDirectoryInput: (name: string, value: Directory, description: string) => Env; - /** - * Declare a desired Directory output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withDirectoryOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type EnvFile in the environment - * @param name The name of the binding - * @param value The EnvFile value to assign to the binding - * @param description The purpose of the input - */ - withEnvFileInput: (name: string, value: EnvFile, description: string) => Env; - /** - * Declare a desired EnvFile output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withEnvFileOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Env in the environment - * @param name The name of the binding - * @param value The Env value to assign to the binding - * @param description The purpose of the input - */ - withEnvInput: (name: string, value: Env, description: string) => Env; - /** - * Declare a desired Env output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withEnvOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type File in the environment - * @param name The name of the binding - * @param value The File value to assign to the binding - * @param description The purpose of the input - */ - withFileInput: (name: string, value: File, description: string) => Env; - /** - * Declare a desired File output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withFileOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type GeneratorGroup in the environment - * @param name The name of the binding - * @param value The GeneratorGroup value to assign to the binding - * @param description The purpose of the input - */ - withGeneratorGroupInput: (name: string, value: GeneratorGroup, description: string) => Env; - /** - * Declare a desired GeneratorGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withGeneratorGroupOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Generator in the environment - * @param name The name of the binding - * @param value The Generator value to assign to the binding - * @param description The purpose of the input - */ - withGeneratorInput: (name: string, value: Generator, description: string) => Env; - /** - * Declare a desired Generator output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withGeneratorOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type GitRef in the environment - * @param name The name of the binding - * @param value The GitRef value to assign to the binding - * @param description The purpose of the input - */ - withGitRefInput: (name: string, value: GitRef, description: string) => Env; - /** - * Declare a desired GitRef output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withGitRefOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type GitRepository in the environment - * @param name The name of the binding - * @param value The GitRepository value to assign to the binding - * @param description The purpose of the input - */ - withGitRepositoryInput: (name: string, value: GitRepository, description: string) => Env; - /** - * Declare a desired GitRepository output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withGitRepositoryOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type HTTPState in the environment - * @param name The name of the binding - * @param value The HTTPState value to assign to the binding - * @param description The purpose of the input - */ - withHTTPStateInput: (name: string, value: HTTPState, description: string) => Env; - /** - * Declare a desired HTTPState output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withHTTPStateOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type JSONValue in the environment - * @param name The name of the binding - * @param value The JSONValue value to assign to the binding - * @param description The purpose of the input - */ - withJSONValueInput: (name: string, value: JSONValue, description: string) => Env; - /** - * Declare a desired JSONValue output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withJSONValueOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type LLMContentBlock in the environment - * @param name The name of the binding - * @param value The LLMContentBlock value to assign to the binding - * @param description The purpose of the input - */ - withLLMContentBlockInput: (name: string, value: LLMContentBlock, description: string) => Env; - /** - * Declare a desired LLMContentBlock output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withLLMContentBlockOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type LLMMessage in the environment - * @param name The name of the binding - * @param value The LLMMessage value to assign to the binding - * @param description The purpose of the input - */ - withLLMMessageInput: (name: string, value: LLMMessage, description: string) => Env; - /** - * Declare a desired LLMMessage output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withLLMMessageOutput: (name: string, description: string) => Env; - /** - * Sets the main module for this environment (the project being worked on) - * - * Contextual path arguments will be populated using the environment's workspace. - */ - withMainModule: (module_: Module_) => Env; - /** - * Installs a module into the environment, exposing its functions to the model - * - * Contextual path arguments will be populated using the environment's workspace. - * @deprecated Use withMainModule instead - */ - withModule: (module_: Module_) => Env; - /** - * Create or update a binding of type ModuleConfigClient in the environment - * @param name The name of the binding - * @param value The ModuleConfigClient value to assign to the binding - * @param description The purpose of the input - */ - withModuleConfigClientInput: (name: string, value: ModuleConfigClient, description: string) => Env; - /** - * Declare a desired ModuleConfigClient output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withModuleConfigClientOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Module in the environment - * @param name The name of the binding - * @param value The Module value to assign to the binding - * @param description The purpose of the input - */ - withModuleInput: (name: string, value: Module_, description: string) => Env; - /** - * Declare a desired Module output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withModuleOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type ModuleSource in the environment - * @param name The name of the binding - * @param value The ModuleSource value to assign to the binding - * @param description The purpose of the input - */ - withModuleSourceInput: (name: string, value: ModuleSource, description: string) => Env; - /** - * Declare a desired ModuleSource output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withModuleSourceOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Schema in the environment - * @param name The name of the binding - * @param value The Schema value to assign to the binding - * @param description The purpose of the input - */ - withSchemaInput: (name: string, value: Schema, description: string) => Env; - /** - * Declare a desired Schema output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withSchemaOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type SearchResult in the environment - * @param name The name of the binding - * @param value The SearchResult value to assign to the binding - * @param description The purpose of the input - */ - withSearchResultInput: (name: string, value: SearchResult, description: string) => Env; - /** - * Declare a desired SearchResult output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withSearchResultOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type SearchSubmatch in the environment - * @param name The name of the binding - * @param value The SearchSubmatch value to assign to the binding - * @param description The purpose of the input - */ - withSearchSubmatchInput: (name: string, value: SearchSubmatch, description: string) => Env; - /** - * Declare a desired SearchSubmatch output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withSearchSubmatchOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Secret in the environment - * @param name The name of the binding - * @param value The Secret value to assign to the binding - * @param description The purpose of the input - */ - withSecretInput: (name: string, value: Secret, description: string) => Env; - /** - * Declare a desired Secret output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withSecretOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Service in the environment - * @param name The name of the binding - * @param value The Service value to assign to the binding - * @param description The purpose of the input - */ - withServiceInput: (name: string, value: Service, description: string) => Env; - /** - * Declare a desired Service output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withServiceOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Socket in the environment - * @param name The name of the binding - * @param value The Socket value to assign to the binding - * @param description The purpose of the input - */ - withSocketInput: (name: string, value: Socket, description: string) => Env; - /** - * Declare a desired Socket output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withSocketOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Stat in the environment - * @param name The name of the binding - * @param value The Stat value to assign to the binding - * @param description The purpose of the input - */ - withStatInput: (name: string, value: Stat, description: string) => Env; - /** - * Declare a desired Stat output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withStatOutput: (name: string, description: string) => Env; - /** - * Provides a string input binding to the environment - * @param name The name of the binding - * @param value The string value to assign to the binding - * @param description The description of the input - */ - withStringInput: (name: string, value: string, description: string) => Env; - /** - * Declares a desired string output binding - * @param name The name of the binding - * @param description The description of the output - */ - withStringOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type UpGroup in the environment - * @param name The name of the binding - * @param value The UpGroup value to assign to the binding - * @param description The purpose of the input - */ - withUpGroupInput: (name: string, value: UpGroup, description: string) => Env; - /** - * Declare a desired UpGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withUpGroupOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Up in the environment - * @param name The name of the binding - * @param value The Up value to assign to the binding - * @param description The purpose of the input - */ - withUpInput: (name: string, value: Up, description: string) => Env; - /** - * Declare a desired Up output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withUpOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Volume in the environment - * @param name The name of the binding - * @param value The Volume value to assign to the binding - * @param description The purpose of the input - */ - withVolumeInput: (name: string, value: Volume, description: string) => Env; - /** - * Declare a desired Volume output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withVolumeOutput: (name: string, description: string) => Env; - /** - * Returns a new environment with the provided workspace - * @param workspace The directory to set as the host filesystem - */ - withWorkspace: (workspace: Directory) => Env; - /** - * Create or update a binding of type WorkspaceGit in the environment - * @param name The name of the binding - * @param value The WorkspaceGit value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceGitInput: (name: string, value: WorkspaceGit, description: string) => Env; - /** - * Declare a desired WorkspaceGit output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceGitOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type Workspace in the environment - * @param name The name of the binding - * @param value The Workspace value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceInput: (name: string, value: Workspace, description: string) => Env; - /** - * Create or update a binding of type WorkspaceMigration in the environment - * @param name The name of the binding - * @param value The WorkspaceMigration value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceMigrationInput: (name: string, value: WorkspaceMigration, description: string) => Env; - /** - * Declare a desired WorkspaceMigration output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceMigrationOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type WorkspaceMigrationStep in the environment - * @param name The name of the binding - * @param value The WorkspaceMigrationStep value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceMigrationStepInput: (name: string, value: WorkspaceMigrationStep, description: string) => Env; - /** - * Declare a desired WorkspaceMigrationStep output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceMigrationStepOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type WorkspaceModule in the environment - * @param name The name of the binding - * @param value The WorkspaceModule value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceModuleInput: (name: string, value: WorkspaceModule, description: string) => Env; - /** - * Declare a desired WorkspaceModule output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceModuleOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type WorkspaceModuleSetting in the environment - * @param name The name of the binding - * @param value The WorkspaceModuleSetting value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceModuleSettingInput: (name: string, value: WorkspaceModuleSetting, description: string) => Env; - /** - * Declare a desired WorkspaceModuleSetting output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceModuleSettingOutput: (name: string, description: string) => Env; - /** - * Declare a desired Workspace output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceOutput: (name: string, description: string) => Env; - /** - * Create or update a binding of type WorkspaceSDK in the environment - * @param name The name of the binding - * @param value The WorkspaceSDK value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceSDKInput: (name: string, value: WorkspaceSDK, description: string) => Env; - /** - * Declare a desired WorkspaceSDK output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceSDKOutput: (name: string, description: string) => Env; - /** - * Returns a new environment without any outputs - */ - withoutOutputs: () => Env; - workspace: () => Directory; - /** - * Call the provided function with current Env. - * - * This is useful for reusability and readability by not breaking the calling chain. - */ - with: (arg: (param: Env) => Env) => Env; -} -/** - * A collection of environment variables. - */ -declare class EnvFile extends BaseClient { - private readonly _id?; - private readonly _exists?; - private readonly _get?; - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor(ctx?: Context, _id?: ID, _exists?: boolean, _get?: string); - /** - * A unique identifier for this EnvFile. - */ - id: () => Promise; - /** - * Return as a file - */ - asFile: () => File; - /** - * Check if a variable exists - * @param name Variable name - */ - exists: (name: string) => Promise; - /** - * Lookup a variable (last occurrence wins) and return its value, or an empty string - * @param name Variable name - * @param opts.raw Return the value exactly as written to the file. No quote removal or variable expansion - */ - get: (name: string, opts?: EnvFileGetOpts) => Promise; - /** - * Filters variables by prefix and removes the pref from keys. Variables without the prefix are excluded. For example, with the prefix "MY_APP_" and variables: MY_APP_TOKEN=topsecret MY_APP_NAME=hello FOO=bar the resulting environment will contain: TOKEN=topsecret NAME=hello - * @param prefix The prefix to filter by - */ - namespace_: (prefix: string) => EnvFile; - /** - * Return all variables - * @param opts.raw Return values exactly as written to the file. No quote removal or variable expansion - */ - variables: (opts?: EnvFileVariablesOpts) => Promise; - /** - * Add a variable - * @param name Variable name - * @param value Variable value - */ - withVariable: (name: string, value: string) => EnvFile; - /** - * Remove all occurrences of the named variable - * @param name Variable name - */ - withoutVariable: (name: string) => EnvFile; - /** - * Call the provided function with current EnvFile. - * - * This is useful for reusability and readability by not breaking the calling chain. - */ - with: (arg: (param: EnvFile) => EnvFile) => EnvFile; -} -/** - * An environment variable name and value. - */ -declare class EnvVariable extends BaseClient { - private readonly _id?; - private readonly _name?; - private readonly _value?; - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor(ctx?: Context, _id?: ID, _name?: string, _value?: string); - /** - * A unique identifier for this EnvVariable. - */ - id: () => Promise; - /** - * The environment variable name. - */ - name: () => Promise; - /** - * The environment variable value. - */ - value: () => Promise; -} -declare class Error$1 extends BaseClient { - private readonly _id?; - private readonly _message?; - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor(ctx?: Context, _id?: ID, _message?: string); - /** - * A unique identifier for this Error. - */ - id: () => Promise; - /** - * A description of the error. + * A description of the error. */ message: () => Promise; /** @@ -5215,7 +4510,7 @@ declare class FieldTypeDef extends BaseClient { /** * The location of this field declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * The type of the field. */ @@ -5301,7 +4596,7 @@ declare class File extends BaseClient { /** * Return file status */ - stat: () => Stat; + stat: () => Promise; /** * Force evaluation in the engine. */ @@ -5383,11 +4678,15 @@ declare class Function_ extends BaseClient { /** * The location of this function declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * If this function is provided by a module, the name of the module. Unset otherwise. */ sourceModuleName: () => Promise; + /** + * Returns the function with a flag indicating it is an agent middleware. + */ + withAgent: () => Function_; /** * Returns the function with the provided argument * @param name The name of the argument @@ -5492,7 +4791,7 @@ declare class FunctionArg extends BaseClient { /** * The location of this arg declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * The type of the argument. */ @@ -5705,17 +5004,109 @@ declare class GeneratorGroup extends BaseClient { */ with: (arg: (param: GeneratorGroup) => GeneratorGroup) => GeneratorGroup; } +/** + * An immutable git commit. + */ +declare class GitCommit extends BaseClient { + private readonly _id?; + private readonly _authorEmail?; + private readonly _authorName?; + private readonly _authoredDate?; + private readonly _committedDate?; + private readonly _committerEmail?; + private readonly _committerName?; + private readonly _message?; + private readonly _messageBody?; + private readonly _messageHeadline?; + private readonly _sha?; + private readonly _shortSha?; + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor(ctx?: Context, _id?: ID, _authorEmail?: string, _authorName?: string, _authoredDate?: string, _committedDate?: string, _committerEmail?: string, _committerName?: string, _message?: string, _messageBody?: string, _messageHeadline?: string, _sha?: string, _shortSha?: string); + /** + * A unique identifier for this GitCommit. + */ + id: () => Promise; + /** + * The latest semver release tag reachable from this commit. + * @param opts.includePreRelease Include pre-release tags when choosing the latest tag. + */ + ancestorReleaseTag: (opts?: GitCommitAncestorReleaseTagOpts) => Promise; + /** + * Git author email. + */ + authorEmail: () => Promise; + /** + * Git author name. + */ + authorName: () => Promise; + /** + * Git author date, in RFC3339 format. + */ + authoredDate: () => Promise; + /** + * Git committer date, in RFC3339 format. + */ + committedDate: () => Promise; + /** + * Git committer email. + */ + committerEmail: () => Promise; + /** + * Git committer name. + */ + committerName: () => Promise; + /** + * Full commit message. + */ + message: () => Promise; + /** + * Commit message body, excluding the headline. + */ + messageBody: () => Promise; + /** + * First line of the commit message. + */ + messageHeadline: () => Promise; + /** + * Parent commit SHAs. + */ + parentShas: () => Promise; + /** + * The latest semver release tag that points directly at this commit. + * @param opts.includePreRelease Include pre-release tags when choosing the latest tag. + */ + releaseTag: (opts?: GitCommitReleaseTagOpts) => Promise; + /** + * The full commit SHA. + */ + sha: () => Promise; + /** + * The abbreviated commit SHA. + */ + shortSha: () => Promise; + /** + * The filesystem tree at this commit. + * @param opts.discardGitDir Set to true to discard .git directory. + * @param opts.depth The depth of the tree to fetch. + * @param opts.includeTags Set to true to populate tag refs in the local checkout .git. + */ + tree: (opts?: GitCommitTreeOpts) => Directory; +} /** * A git ref (tag, branch, or commit). */ declare class GitRef extends BaseClient { private readonly _id?; private readonly _commit?; + private readonly _commitSHA?; + private readonly _name?; private readonly _ref?; /** * Constructor is used for internal usage only, do not create object from it. */ - constructor(ctx?: Context, _id?: ID, _commit?: string, _ref?: string); + constructor(ctx?: Context, _id?: ID, _commit?: string, _commitSHA?: string, _name?: string, _ref?: string); /** * A unique identifier for this GitRef. */ @@ -5727,17 +5118,38 @@ declare class GitRef extends BaseClient { asWorkspace: (opts?: GitRefAsWorkspaceOpts) => Workspace; /** * The resolved commit id at this ref. + * @deprecated Use "commitSHA" instead. */ commit: () => Promise; + /** + * The resolved commit SHA at this ref. + */ + commitSHA: () => Promise; /** * Find the best common ancestor between this ref and another ref. * @param other The other ref to compare against. */ commonAncestor: (other: GitRef) => GitRef; + /** + * Commits reachable from this ref, newest first, starting with the commit this ref resolves to. + * @param opts.limit Maximum number of commits to return. + * @param opts.paths Only include commits touching these paths, relative to the root of the repository. + * @param opts.base Exclude commits reachable from this ref, i.e. only list commits added on top of it. + */ + log: (opts?: GitRefLogOpts) => Promise; + /** + * The resolved name of this ref. + */ + name: () => Promise; /** * The resolved ref name at this ref. + * @deprecated Use "name" instead. */ ref: () => Promise; + /** + * The commit this ref resolves to. + */ + targetCommit: () => GitCommit; /** * The filesystem tree at this ref. * @param opts.discardGitDir Set to true to discard .git directory. @@ -5785,7 +5197,7 @@ declare class GitRepository extends BaseClient { * Returns details of a commit. * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b"). */ - commit: (id: string) => GitRef; + commit: (id: string) => GitCommit; /** * Returns details for HEAD. */ @@ -6007,7 +5419,7 @@ declare class InterfaceTypeDef extends BaseClient { /** * The location of this interface declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * If this InterfaceTypeDef is associated with a Module, the name of the module. Unset otherwise. */ @@ -6096,12 +5508,14 @@ declare class JSONValue extends BaseClient { */ declare class LLM extends BaseClient { private readonly _id?; + private readonly _contextTokens?; private readonly _contextWindow?; private readonly _hasPending?; private readonly _lastReply?; private readonly _model?; private readonly _portableID?; private readonly _provider?; + private readonly _reasoningEffort?; private readonly _replay?; private readonly _sync?; private readonly _tools?; @@ -6109,23 +5523,19 @@ declare class LLM extends BaseClient { /** * Constructor is used for internal usage only, do not create object from it. */ - constructor(ctx?: Context, _id?: ID, _contextWindow?: number, _hasPending?: boolean, _lastReply?: string, _model?: string, _portableID?: ID, _provider?: string, _replay?: ID, _sync?: ID, _tools?: string, _transcript?: string); + constructor(ctx?: Context, _id?: ID, _contextTokens?: number, _contextWindow?: number, _hasPending?: boolean, _lastReply?: string, _model?: string, _portableID?: ID, _provider?: string, _reasoningEffort?: string, _replay?: ID, _sync?: ID, _tools?: string, _transcript?: string); /** * A unique identifier for this LLM. */ id: () => Promise; /** - * returns the type of the current state + * estimated number of tokens currently occupying the context window; unlike tokenUsage this is not cumulative over the session */ - bindResult: (name: string) => Binding; + contextTokens: () => Promise; /** * The model's total context window in tokens, or null if unknown (e.g. a local or uncatalogued model). */ contextWindow: () => Promise; - /** - * return the LLM's current environment - */ - env: () => Env; /** * Fork the conversation, so that otherwise-identical follow-ups evaluate independently instead of deduplicating to a single cached result. * @param label A label distinguishing this fork from its siblings, e.g. "attempt-2" when retrying a flaky evaluation. @@ -6154,17 +5564,25 @@ declare class LLM extends BaseClient { */ model: () => Promise; /** - * A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. + * A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. The recipe is flattened: bindings superseded during the session (workspace overlays recorded by each mutating tool call, and re-bound toolsets) are dropped, while the current workspace binding — including any pending, un-exported edits — is preserved. */ portableID: () => Promise; /** * The provider serving the model, e.g. "anthropic", "openai", "google", or "local". */ provider: () => Promise; + /** + * The reasoning effort in use, e.g. "low", "medium", or "high". Empty or "none" when reasoning is disabled. + */ + reasoningEffort: () => Promise; /** * Re-emit telemetry spans for the full message history, so a loaded conversation displays in the TUI. */ replay: () => Promise; + /** + * The skills visible to the model, exactly as the ListSkills tool serves them: engine-embedded skills, skills installed with withSkills, and skills discovered in the workspace. + */ + skills: () => Promise; /** * Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn. * @param opts.maxTokens Cap the model's output tokens for this step. Defaults to the model's maximum. @@ -6186,18 +5604,6 @@ declare class LLM extends BaseClient { * The message history rendered as a plain-text transcript, suitable for feeding back to an LLM (e.g. for summarization). */ transcript: () => Promise; - /** - * Return a new LLM with the specified function no longer exposed as a tool - * @param typeName The type name whose function will be blocked - * @param function The function to block - * - * Will be converted to lowerCamelCase if necessary. - */ - withBlockedFunction: (typeName: string, function_: string) => LLM; - /** - * allow the LLM to interact with an environment via MCP - */ - withEnv: (env: Env) => LLM; /** * Add an external MCP server to the LLM * @param name The name of the MCP server @@ -6210,12 +5616,6 @@ declare class LLM extends BaseClient { * @param opts.provider The provider serving the model, e.g. "openai". Overrides the provider otherwise inferred from the model name — useful when the name matches no known pattern (e.g. a fine-tune), or matches the wrong one. */ withModel: (model: string, opts?: LLMWithModelOpts) => LLM; - /** - * Track an object so the LLM can reference it in subsequent tool calls. - * @param tag Arbitrary string tag for the object, typically in TypeName#Number format - * @param object The object to track, as a generic ID - */ - withObject: (tag: string, object: ID) => LLM; /** * Queue a user prompt, to be sent to the model on the next step or loop. * @param prompt The prompt to send @@ -6226,6 +5626,11 @@ declare class LLM extends BaseClient { * @param file The file to read the prompt from */ withPromptFile: (file: File) => LLM; + /** + * Change the reasoning effort for the rest of the conversation, overriding any configured default. The message history is preserved; the new effort takes effect on the next step. + * @param effort The reasoning effort, e.g. "low", "medium", or "high"; "none" disables reasoning. Supported levels are model-specific — some models also accept e.g. "minimal", "xhigh", or "max". + */ + withReasoningEffort: (effort: string) => LLM; /** * Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source. * @param content The response content @@ -6237,9 +5642,10 @@ declare class LLM extends BaseClient { */ withResponse: (content: LLMContentBlockInput[], opts?: LLMWithResponseOpts) => LLM; /** - * Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration + * Install skills from a directory, adding them to the skills the model discovers with ListSkills and reads with ReadSkill. Each skill is a directory containing a SKILL.md with name and description frontmatter, discovered anywhere in the tree. Installed skills take precedence over skills discovered in the workspace, but cannot shadow the engine's built-in skills. + * @param directory A directory containing skills, each a subdirectory holding a SKILL.md. */ - withStaticTools: () => LLM; + withSkills: (directory: Directory) => LLM; /** * Add a system prompt, instructing the model across the whole conversation. * @param prompt The system prompt to send @@ -6252,6 +5658,17 @@ declare class LLM extends BaseClient { * @param errored Whether the tool call resulted in an error */ withToolResult: (callId: string, content: string, errored: boolean) => LLM; + /** + * Expose an object's methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object's own type replaces it as the new state. Repeatable to bind several objects. + * @param object The object whose methods become tools. + * @param opts.except Method names to exclude from the toolset (e.g. constructors, entrypoints). + */ + withTools: (object: Node, opts?: LLMWithToolsOpts) => LLM; + /** + * Bind the LLM to a workspace, exposing its modules as tools exactly as the Dagger CLI would serve them for that workspace. + * @param workspace The workspace to work in. + */ + withWorkspace: (workspace: Workspace) => LLM; /** * Disable the default system prompt */ @@ -6264,6 +5681,10 @@ declare class LLM extends BaseClient { * Clear the user-added system prompts, keeping only the default system prompt. */ withoutSystemPrompts: () => LLM; + /** + * Return the workspace the LLM is bound to. + */ + workspace: () => Workspace; /** * Call the provided function with current LLM. * @@ -6347,6 +5768,30 @@ declare class LLMMessage extends BaseClient { */ tokenUsage: () => LLMTokenUsage; } +/** + * A skill available to a model: task-specific guidance discovered with ListSkills and read with ReadSkill. + */ +declare class LLMSkill extends BaseClient { + private readonly _id?; + private readonly _description?; + private readonly _name?; + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor(ctx?: Context, _id?: ID, _description?: string, _name?: string); + /** + * A unique identifier for this LLMSkill. + */ + id: () => Promise; + /** + * The one-line description from the SKILL.md frontmatter. + */ + description: () => Promise; + /** + * The skill name, as passed to ReadSkill. + */ + name: () => Promise; +} /** * A count of tokens consumed by LLM API calls. */ @@ -6509,11 +5954,11 @@ declare class Module_ extends BaseClient { /** * The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile. */ - runtime: () => Container; + runtime: () => Promise; /** * The SDK config used by this module. */ - sdk: () => SDKConfig; + sdk: () => Promise; /** * Serve a module's API in the current session. * @@ -6531,7 +5976,7 @@ declare class Module_ extends BaseClient { /** * The source for the module. */ - source: () => ModuleSource; + source: () => Promise; /** * Forces evaluation of the module, including any loading into the engine and associated validation. */ @@ -6676,6 +6121,13 @@ declare class ModuleSource extends BaseClient { * The engine version of the module. */ engineVersion: () => Promise; + /** + * Return the supplied workspace with this module's generated context applied. + * + * The workspace change baseline is preserved, so a later Workspace.changes call includes this generation together with any other edits made by the caller. + * @param workspace The workspace to apply generated files to. + */ + generate: (workspace: Workspace) => Workspace; /** * Generate this module's transitive local dependency closure and return the staged changes as a single changeset against the unstaged workspace root. * @@ -6738,7 +6190,7 @@ declare class ModuleSource extends BaseClient { /** * The SDK configuration of the module. */ - sdk: () => SDKConfig; + sdk: () => Promise; /** * The path, relative to the context directory, that contains the module config. */ @@ -6911,7 +6363,7 @@ declare class ObjectTypeDef extends BaseClient { /** * The function used to construct new instances of this object, if any. */ - constructor_: () => Function_; + constructor_: () => Promise; /** * The reason this enum member is deprecated, if any. */ @@ -6935,7 +6387,7 @@ declare class ObjectTypeDef extends BaseClient { /** * The location of this object declaration. */ - sourceMap: () => SourceMap; + sourceMap: () => Promise; /** * If this ObjectTypeDef is associated with a Module, the name of the module. Unset otherwise. */ @@ -7025,15 +6477,6 @@ declare class Client extends BaseClient { * @param opts.platform Platform to initialize the container with. Defaults to the native platform of the current engine */ container: (opts?: ClientContainerOpts) => Container; - /** - * Returns the current environment - * - * When called from a function invoked via an LLM tool call, this will be the LLM's current environment, including any modifications made through calling tools. Env values returned by functions become the new environment for subsequent calls, and Changeset values returned by functions are applied to the environment's workspace. - * - * When called from a module function outside of an LLM, this returns an Env with the current module installed, and with the current module's source directory as its workspace. - * @experimental - */ - currentEnv: () => Env; /** * The FunctionCall context that the SDK caller is currently executing in. * @@ -7044,6 +6487,10 @@ declare class Client extends BaseClient { * The module currently being served in the session, if any. */ currentModule: () => CurrentModule; + /** + * The object that received the current module function call, as a Node. Errors when there is no current call, or the call is top-level (e.g. a module constructor). + */ + currentNode: () => Node; /** * The TypeDef representations of the objects currently being served in the session. * @param opts.returnAllTypes Return the full referenced typedef closure instead of only top-level served typedefs. @@ -7070,12 +6517,11 @@ declare class Client extends BaseClient { */ engine: () => Engine; /** - * Initializes a new environment - * @param opts.privileged Give the environment the same privileges as the caller: core API including host access, current module, and dependencies - * @param opts.writable Allow new outputs to be declared and saved in the environment - * @experimental + * Constructs an engine-managed volume backed by operator-provided storage beneath the configured engine state root. + * @param name Canonical slash-separated volume name beneath the engine volume namespace. + * @param opts.subdir Optional existing subdirectory within the volume payload to mount. */ - env: (opts?: ClientEnvOpts) => Env; + engineVolume: (name: string, opts?: ClientEngineVolumeOpts) => Volume; /** * Initialize an environment file * @param opts.expand Replace "${VAR}" or "$VAR" with the value of other vars @@ -7160,7 +6606,7 @@ declare class Client extends BaseClient { /** * Load any object by its ID. */ - node: (id: ID) => Node; + node: (id: ID) => Promise; /** * Load a GraphQL introspection schema for merging. * @param json The introspection schema JSON to load. @@ -7617,27 +7063,27 @@ declare class TypeDef extends BaseClient { /** * If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null. */ - asEnum: () => EnumTypeDef; + asEnum: () => Promise; /** * If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null. */ - asInput: () => InputTypeDef; + asInput: () => Promise; /** * If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null. */ - asInterface: () => InterfaceTypeDef; + asInterface: () => Promise; /** * If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null. */ - asList: () => ListTypeDef; + asList: () => Promise; /** * If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null. */ - asObject: () => ObjectTypeDef; + asObject: () => Promise; /** * If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null. */ - asScalar: () => ScalarTypeDef; + asScalar: () => Promise; /** * The kind of type this is (e.g. primitive, list, object). */ @@ -7829,9 +7275,17 @@ declare class Workspace extends BaseClient { */ address: () => Promise; /** - * Return this workspace's pending overlay changes. + * Return all agent middlewares from modules loaded in the workspace. + * @param opts.include Only include agents matching the specified patterns */ - changes: () => Changeset; + agents: (opts?: WorkspaceAgentsOpts) => AgentGroup; + /** + * Return this workspace's changes, with paths relative to its working directory. + * + * Pass from to compare against an earlier workspace state. Omitting it preserves the cumulative behavior used by clients from before this argument was added. + * @param opts.from An earlier workspace state to compare against. + */ + changes: (opts?: WorkspaceChangesOpts) => Changeset; /** * Return all checks from modules loaded in the workspace. * @param opts.include Only include checks matching the specified patterns @@ -7888,6 +7342,17 @@ declare class Workspace extends BaseClient { * @param path Location of the file to retrieve. Relative paths (e.g., "go.mod") resolve from the workspace cwd; absolute paths (e.g., "/go.mod") resolve from the workspace root. */ file: (path: string) => File; + /** + * Find project roots marked by any of the given filenames, starting from a path relative to the workspace cwd. + * + * Returns cwd-relative directory paths for every marked directory at or below start, plus the nearest marked ancestor when start itself is not marked. + * + * Each returned path is usable as-is with other workspace APIs, e.g. directory(path). + * @param opts.start Directory to start from. Relative paths resolve from the workspace cwd. + * @param opts.markers File basenames that mark a project root (e.g. ["go.mod"] or ["deno.json", "deno.jsonc"]). + * @param opts.exclude Glob patterns pruning the walk below start (e.g. ["**\/node_modules/**"]). + */ + findRoots: (opts?: WorkspaceFindRootsOpts) => Promise; /** * Search for a file or directory by walking up from the start path within the workspace. * @@ -7924,6 +7389,8 @@ declare class Workspace extends BaseClient { migrate: () => WorkspaceMigration; /** * Return a module defined in the workspace configuration. + * + * Reflects the selected env's effective view. * @param name Module name to inspect. */ module_: (name: string) => WorkspaceModule; @@ -7938,8 +7405,14 @@ declare class Workspace extends BaseClient { moduleSource: (path: string) => ModuleSource; /** * List modules defined in the workspace configuration. + * + * Reflects the selected env's effective view. */ modules: () => Promise; + /** + * Return this workspace with its cached host reads invalidated, so subsequent file and directory reads re-read the live host instead of a snapshot cached earlier in the session. + */ + reloaded: () => Workspace; /** * An installed SDK, by name. * @param name SDK name to look up. @@ -7986,6 +7459,8 @@ declare class Workspace extends BaseClient { withConfigEnv: (name: string, opts?: WorkspaceWithConfigEnvOpts) => Workspace; /** * Return this workspace with a configuration value written. + * + * When the session selects an env, the key is scoped to that env's overlay and the env is created if missing. * @param key Dotted key path. * @param value Value to set. Bools, integers, and comma-separated arrays are auto-detected. * @param opts.values List value to set. Elements are stored verbatim, with no auto-detection. Mutually exclusive with value. @@ -7994,31 +7469,55 @@ declare class Workspace extends BaseClient { withConfigValue: (key: string, value: string, opts?: WorkspaceWithConfigValueOpts) => Workspace; /** * Return this workspace with a generated API client initialized. - * @param path Workspace-relative output directory for the generated client. + * + * The SDK's generators run for the new client, so the returned workspace carries its generated bindings. + * @param path Output directory for the generated client, relative to the workspace cwd; a leading "/" is relative to the workspace root. * @param sdk Workspace SDK name or module entry name to use. * @param module Workspace-relative path or canonical ref for the module the client binds to. * @param opts.args SDK-specific init arguments. * @param opts.here Write to the workspace config directory at the workspace cwd. + * @param opts.noGenerate Skip running the SDK's generators for the new client. */ withInitClient: (path: string, sdk: string, module_: string, opts?: WorkspaceWithInitClientOpts) => Workspace; /** * Return this workspace with a new module initialized. + * + * The SDK's generators run for the new module, so the returned workspace carries the generated code it needs to be loadable. * @param name Name of the new module. * @param sdk Workspace SDK name or module entry name to use. - * @param opts.path Workspace-relative path for the new module. + * @param opts.path Path for the new module, relative to the workspace cwd; a leading "/" is relative to the workspace root. Defaults to .dagger/modules/ beside the workspace config. * @param opts.source Source subpath within the new module. * @param opts.include Additional include patterns for the module. * @param opts.args SDK-specific init arguments. * @param opts.here Write to the workspace config directory at the workspace cwd. + * @param opts.noGenerate Skip running the SDK's generators for the new module. */ withInitModule: (name: string, sdk: string, opts?: WorkspaceWithInitModuleOpts) => Workspace; /** * Return this workspace with a module installed in its config. + * + * When the session selects an env, the module is recorded in that env's overlay and the env is created if missing. * @param ref Module reference to install. * @param opts.name Override name for the installed module entry. * @param opts.here Write to the workspace config directory at the workspace cwd. */ withModule: (ref: string, opts?: WorkspaceWithModuleOpts) => Workspace; + /** + * Return this workspace with a directory mounted read-only at the given path, without mutating the source. + * + * Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified. + * @param path Location of the mounted directory. Relative paths resolve from the workspace cwd. + * @param source Directory to mount. + */ + withMountedDirectory: (path: string, source: Directory) => Workspace; + /** + * Return this workspace with a file mounted read-only at the given path, without mutating the source. + * + * Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified. + * @param path Location of the mounted file. Relative paths resolve from the workspace cwd. + * @param source File to mount. + */ + withMountedFile: (path: string, source: File) => Workspace; /** * Return this workspace with a directory added, without mutating the source. * @param path Path of the added directory. Relative paths resolve from the workspace cwd. @@ -8059,12 +7558,26 @@ declare class Workspace extends BaseClient { * Return this workspace with a configuration value removed. * * Errors when the key is not currently set. + * + * When the session selects an env, the key is scoped to that env's overlay. * @param key Dotted key path (e.g. modules.greeter.settings.greeting). * @param opts.here Write to the workspace config directory at the workspace cwd. */ withoutConfigValue: (key: string, opts?: WorkspaceWithoutConfigValueOpts) => Workspace; + /** + * Return this workspace with a directory removed, without mutating the source. + * @param path Path of the directory to remove. Relative paths resolve from the workspace cwd. + */ + withoutDirectory: (path: string) => Workspace; + /** + * Return this workspace with a file removed, without mutating the source. + * @param path Path of the file to remove. Relative paths resolve from the workspace cwd. + */ + withoutFile: (path: string) => Workspace; /** * Return this workspace with a module removed from its config. + * + * When the session selects an env, only that env's overlay entry is removed. * @param name Name of the installed module entry to remove. * @param opts.here Write to the workspace config directory at the workspace cwd. */ @@ -8678,6 +8191,15 @@ declare const generate: () => ((target: object, propertyKey: string | symbol, de * The definition of @up decorator that marks a function as a service for dagger up. */ declare const up: () => ((target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor); +/** + * The definition of @agent decorator that marks a function as an agent + * middleware: it takes a base LLM and returns an LLM with the module's tools + * and prompting folded onto it. `dagger agent` discovers and composes these. + * + * Besides the base LLM, an agent function may not declare any other required + * argument. + */ +declare const agent: () => ((target: object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => void); /** * The definition of @field decorator that should be on top of any * class' property that must be exposed to the Dagger API. @@ -8713,5 +8235,5 @@ declare const argument: (opts?: ArgumentOptions) => ((target: object, propertyKe declare function entrypoint(files: string[]): Promise; -export { Address, BaseClient, Binding, CacheSharingMode, CacheSharingModeNameToValue, CacheSharingModeValueToName, CacheVolume, Changeset, ChangesetMergeConflict, ChangesetMergeConflictNameToValue, ChangesetMergeConflictValueToName, ChangesetsMergeConflict, ChangesetsMergeConflictNameToValue, ChangesetsMergeConflictValueToName, Check, CheckGroup, Client, ClientFilesyncMirror, Cloud, Container, Context, CurrentModule, CurrentModuleAsSDK, CurrentModuleAsSDKClient, CurrentModuleAsSDKModule, DaggerSDKError, DiffStat, DiffStatKind, DiffStatKindNameToValue, DiffStatKindValueToName, Directory, DockerImageRefValidationError, ERROR_CODES, Engine, EngineCache, EngineCacheEntry, EngineCacheEntrySet, EngineSessionConnectParamsParseError, EngineSessionConnectionTimeoutError, EngineSessionError, EnumTypeDef, EnumValueTypeDef, Env, EnvFile, EnvVariable, Error$1 as Error, ErrorValue, ExecError, ExistsType, ExistsTypeNameToValue, ExistsTypeValueToName, FieldTypeDef, File, FileType, FileTypeNameToValue, FileTypeValueToName, FunctionArg, FunctionCachePolicy, FunctionCachePolicyNameToValue, FunctionCachePolicyValueToName, FunctionCall, FunctionCallArgValue, FunctionNotFound, Function_, GeneratedCode, Generator, GeneratorGroup, GitRef, GitRepository, GraphQLRequestError, HTTPState, HealthcheckConfig, Host, ImageLayerCompression, ImageLayerCompressionNameToValue, ImageLayerCompressionValueToName, ImageMediaTypes, ImageMediaTypesNameToValue, ImageMediaTypesValueToName, InitEngineSessionBinaryError, InputTypeDef, InterfaceTypeDef, IntrospectionError, JSONValue, LLM, LLMContentBlock, LLMContentBlockKind, LLMContentBlockKindNameToValue, LLMContentBlockKindValueToName, LLMMessage, LLMMessageRole, LLMMessageRoleNameToValue, LLMMessageRoleValueToName, LLMTokenUsage, Label, ListTypeDef, ModuleConfigClient, ModuleSource, ModuleSourceExperimentalFeature, ModuleSourceExperimentalFeatureNameToValue, ModuleSourceExperimentalFeatureValueToName, ModuleSourceKind, ModuleSourceKindNameToValue, ModuleSourceKindValueToName, Module_, NetworkProtocol, NetworkProtocolNameToValue, NetworkProtocolValueToName, NotAwaitedRequestError, ObjectTypeDef, Port, RegistryProtocol, RegistryProtocolNameToValue, RegistryProtocolValueToName, RemoteGitMirror, ReturnType, ReturnTypeNameToValue, ReturnTypeValueToName, SDKConfig, ScalarTypeDef, Schema, SearchResult, SearchSubmatch, Secret, Service, Socket, SourceMap, Stat, Terminal, TooManyNestedObjectsError, TypeDef, TypeDefKind, TypeDefKindNameToValue, TypeDefKindValueToName, UnknownDaggerError, Up, UpGroup, Volume, Workspace, WorkspaceGit, WorkspaceMigration, WorkspaceMigrationStep, WorkspaceModule, WorkspaceModuleSetting, WorkspaceSDK, _ExportableClient, _NodeClient, _SyncerClient, argument, check, connect, connection, dag, entrypoint, enumType, field, func, generate, getRegisteredClass, getTracer, object, up }; -export type { AddressDirectoryOpts, AddressFileOpts, BuildArg, CallbackFct, ChangesetWithChangesetOpts, ChangesetWithChangesetsOpts, CheckGroupRunOpts, ClientCacheVolumeOpts, ClientContainerOpts, ClientCurrentTypeDefsOpts, ClientEnvFileOpts, ClientEnvOpts, ClientFileOpts, ClientGitOpts, ClientHttpOpts, ClientLLMOpts, ClientModuleSourceOpts, ClientSecretOpts, ClientSshfsVolumeOpts, ConnectOpts, ContainerAsServiceOpts, ContainerAsTarballOpts, ContainerDirectoryOpts, ContainerExistsOpts, ContainerExportImageOpts, ContainerExportOpts, ContainerFileOpts, ContainerFromOpts, ContainerImportOpts, ContainerLayerOpts, ContainerManifestOpts, ContainerPublishOpts, ContainerStatOpts, ContainerTerminalOpts, ContainerUpOpts, ContainerWithDefaultTerminalCmdOpts, ContainerWithDirectoryOpts, ContainerWithDockerHealthcheckOpts, ContainerWithEntrypointOpts, ContainerWithEnvVariableOpts, ContainerWithExecOpts, ContainerWithExposedPortOpts, ContainerWithFileOpts, ContainerWithFilesOpts, ContainerWithMountedCacheOpts, ContainerWithMountedDirectoryOpts, ContainerWithMountedFileOpts, ContainerWithMountedSecretOpts, ContainerWithMountedTempOpts, ContainerWithMountedVolumeOpts, ContainerWithNewFileOpts, ContainerWithSymlinkOpts, ContainerWithUnixSocketOpts, ContainerWithWorkdirOpts, ContainerWithoutDirectoryOpts, ContainerWithoutEntrypointOpts, ContainerWithoutExposedPortOpts, ContainerWithoutFileOpts, ContainerWithoutFilesOpts, ContainerWithoutMountOpts, ContainerWithoutUnixSocketOpts, CurrentModuleAsSdkOpts, CurrentModuleGeneratorsOpts, CurrentModuleWorkdirOpts, DirectoryAsModuleOpts, DirectoryAsModuleSourceOpts, DirectoryAsWorkspaceOpts, DirectoryDockerBuildOpts, DirectoryEntriesOpts, DirectoryExistsOpts, DirectoryExportOpts, DirectoryFilterOpts, DirectorySearchOpts, DirectoryStatOpts, DirectoryTerminalOpts, DirectoryWithDirectoryOpts, DirectoryWithFileOpts, DirectoryWithFilesOpts, DirectoryWithNewDirectoryOpts, DirectoryWithNewFileOpts, EngineCacheEntrySetOpts, EngineCachePruneOpts, EnvChecksOpts, EnvFileGetOpts, EnvFileVariablesOpts, EnvServicesOpts, Exportable, FileAsEnvFileOpts, FileContentsOpts, FileDigestOpts, FileExportOpts, FileSearchOpts, FileWithReplacedOpts, FunctionWithArgOpts, FunctionWithCachePolicyOpts, FunctionWithDeprecatedOpts, GeneratorGroupChangesOpts, GitRefAsWorkspaceOpts, GitRefTreeOpts, GitRepositoryAsWorkspaceOpts, GitRepositoryBranchesOpts, GitRepositoryTagsOpts, HostDirectoryOpts, HostFileOpts, HostFindUpOpts, HostServiceOpts, HostTunnelOpts, ID, JSON, JSONValueContentsOpts, LLMContentBlockInput, LLMLoopOpts, LLMStepOpts, LLMWithModelOpts, LLMWithResponseOpts, ModuleChecksOpts, ModuleGeneratorsOpts, ModuleServeOpts, ModuleServicesOpts, Node, PipelineLabel, Platform, PortForward, ServiceEndpointOpts, ServiceStopOpts, ServiceTerminalOpts, ServiceUpOpts, Syncer, TypeDefWithEnumMemberOpts, TypeDefWithEnumOpts, TypeDefWithEnumValueOpts, TypeDefWithFieldOpts, TypeDefWithInterfaceOpts, TypeDefWithObjectOpts, TypeDefWithScalarOpts, Void, WorkspaceChecksOpts, WorkspaceConfigReadOpts, WorkspaceDirectoryOpts, WorkspaceFindUpOpts, WorkspaceGeneratorsOpts, WorkspaceSearchOpts, WorkspaceServicesOpts, WorkspaceWithConfigEnvOpts, WorkspaceWithConfigValueOpts, WorkspaceWithInitClientOpts, WorkspaceWithInitModuleOpts, WorkspaceWithModuleOpts, WorkspaceWithNewFileOpts, WorkspaceWithSdkOpts, WorkspaceWithoutConfigEnvOpts, WorkspaceWithoutConfigValueOpts, WorkspaceWithoutModuleOpts, WorkspaceWithoutSdkOpts, __DirectiveArgsOpts, __FieldArgsOpts, __TypeEnumValuesOpts, __TypeFieldsOpts, __TypeInputFieldsOpts, float }; +export { Address, Agent, AgentGroup, BaseClient, CacheSharingMode, CacheSharingModeNameToValue, CacheSharingModeValueToName, CacheVolume, Changeset, ChangesetMergeConflict, ChangesetMergeConflictNameToValue, ChangesetMergeConflictValueToName, ChangesetsMergeConflict, ChangesetsMergeConflictNameToValue, ChangesetsMergeConflictValueToName, Check, CheckGroup, Client, ClientFilesyncMirror, Cloud, Container, Context, CurrentModule, CurrentModuleAsSDK, CurrentModuleAsSDKClient, CurrentModuleAsSDKModule, DaggerSDKError, DiffStat, DiffStatKind, DiffStatKindNameToValue, DiffStatKindValueToName, Directory, DockerImageRefValidationError, ERROR_CODES, Engine, EngineCache, EngineCacheEntry, EngineCacheEntrySet, EngineSessionConnectParamsParseError, EngineSessionConnectionTimeoutError, EngineSessionError, EnumTypeDef, EnumValueTypeDef, EnvFile, EnvVariable, Error$1 as Error, ErrorValue, ExecError, ExistsType, ExistsTypeNameToValue, ExistsTypeValueToName, FieldTypeDef, File, FileType, FileTypeNameToValue, FileTypeValueToName, FunctionArg, FunctionCachePolicy, FunctionCachePolicyNameToValue, FunctionCachePolicyValueToName, FunctionCall, FunctionCallArgValue, FunctionNotFound, Function_, GeneratedCode, Generator, GeneratorGroup, GitCommit, GitRef, GitRepository, GraphQLRequestError, HTTPState, HealthcheckConfig, Host, ImageLayerCompression, ImageLayerCompressionNameToValue, ImageLayerCompressionValueToName, ImageMediaTypes, ImageMediaTypesNameToValue, ImageMediaTypesValueToName, InitEngineSessionBinaryError, InputTypeDef, InterfaceTypeDef, IntrospectionError, JSONValue, LLM, LLMContentBlock, LLMContentBlockKind, LLMContentBlockKindNameToValue, LLMContentBlockKindValueToName, LLMMessage, LLMMessageRole, LLMMessageRoleNameToValue, LLMMessageRoleValueToName, LLMSkill, LLMTokenUsage, Label, ListTypeDef, ModuleConfigClient, ModuleSource, ModuleSourceExperimentalFeature, ModuleSourceExperimentalFeatureNameToValue, ModuleSourceExperimentalFeatureValueToName, ModuleSourceKind, ModuleSourceKindNameToValue, ModuleSourceKindValueToName, Module_, NetworkProtocol, NetworkProtocolNameToValue, NetworkProtocolValueToName, NotAwaitedRequestError, ObjectTypeDef, PatchConflict, PatchConflictNameToValue, PatchConflictValueToName, Port, RegistryProtocol, RegistryProtocolNameToValue, RegistryProtocolValueToName, RemoteGitMirror, ReturnType, ReturnTypeNameToValue, ReturnTypeValueToName, SDKConfig, ScalarTypeDef, Schema, SearchResult, SearchSubmatch, Secret, Service, Socket, SourceMap, Stat, Terminal, TooManyNestedObjectsError, TypeDef, TypeDefKind, TypeDefKindNameToValue, TypeDefKindValueToName, UnknownDaggerError, Up, UpGroup, Volume, Workspace, WorkspaceGit, WorkspaceMigration, WorkspaceMigrationStep, WorkspaceModule, WorkspaceModuleSetting, WorkspaceSDK, _ExportableClient, _NodeClient, _SyncerClient, agent, argument, check, connect, connection, dag, entrypoint, enumType, field, func, generate, getRegisteredClass, getTracer, object, up }; +export type { AddressDirectoryOpts, AddressFileOpts, AgentGroupComposeOpts, BuildArg, CallbackFct, ChangesetWithChangesetOpts, ChangesetWithChangesetsOpts, CheckGroupRunOpts, ClientCacheVolumeOpts, ClientContainerOpts, ClientCurrentTypeDefsOpts, ClientEngineVolumeOpts, ClientEnvFileOpts, ClientFileOpts, ClientGitOpts, ClientHttpOpts, ClientLLMOpts, ClientModuleSourceOpts, ClientSecretOpts, ClientSshfsVolumeOpts, ConnectOpts, ContainerAsServiceOpts, ContainerAsTarballOpts, ContainerDirectoryOpts, ContainerExistsOpts, ContainerExportImageOpts, ContainerExportOpts, ContainerFileOpts, ContainerFromOpts, ContainerImportOpts, ContainerLayerOpts, ContainerManifestOpts, ContainerPublishOpts, ContainerStatOpts, ContainerTerminalOpts, ContainerUpOpts, ContainerWithDefaultTerminalCmdOpts, ContainerWithDirectoryOpts, ContainerWithDockerHealthcheckOpts, ContainerWithEntrypointOpts, ContainerWithEnvVariableOpts, ContainerWithExecOpts, ContainerWithExposedPortOpts, ContainerWithFileOpts, ContainerWithFilesOpts, ContainerWithMountedCacheOpts, ContainerWithMountedDirectoryOpts, ContainerWithMountedFileOpts, ContainerWithMountedSecretOpts, ContainerWithMountedTempOpts, ContainerWithMountedVolumeOpts, ContainerWithNewFileOpts, ContainerWithSymlinkOpts, ContainerWithUnixSocketOpts, ContainerWithWorkdirOpts, ContainerWithoutDirectoryOpts, ContainerWithoutEntrypointOpts, ContainerWithoutExposedPortOpts, ContainerWithoutFileOpts, ContainerWithoutFilesOpts, ContainerWithoutMountOpts, ContainerWithoutUnixSocketOpts, CurrentModuleGeneratorsOpts, CurrentModuleWorkdirOpts, DirectoryAsModuleOpts, DirectoryAsModuleSourceOpts, DirectoryAsWorkspaceOpts, DirectoryDockerBuildOpts, DirectoryEntriesOpts, DirectoryExistsOpts, DirectoryExportOpts, DirectoryFilterOpts, DirectorySearchOpts, DirectoryStatOpts, DirectoryTerminalOpts, DirectoryWithDirectoryOpts, DirectoryWithFileOpts, DirectoryWithFilesOpts, DirectoryWithNewDirectoryOpts, DirectoryWithNewFileOpts, DirectoryWithPatchFileOpts, DirectoryWithPatchOpts, EngineCacheEntrySetOpts, EngineCachePruneOpts, EnvFileGetOpts, EnvFileVariablesOpts, Exportable, FileAsEnvFileOpts, FileContentsOpts, FileDigestOpts, FileExportOpts, FileSearchOpts, FileWithReplacedOpts, FunctionWithArgOpts, FunctionWithCachePolicyOpts, FunctionWithDeprecatedOpts, GeneratorGroupChangesOpts, GitCommitAncestorReleaseTagOpts, GitCommitReleaseTagOpts, GitCommitTreeOpts, GitRefAsWorkspaceOpts, GitRefLogOpts, GitRefTreeOpts, GitRepositoryAsWorkspaceOpts, GitRepositoryBranchesOpts, GitRepositoryTagsOpts, HostDirectoryOpts, HostFileOpts, HostFindUpOpts, HostServiceOpts, HostTunnelOpts, ID, JSON, JSONValueContentsOpts, LLMContentBlockInput, LLMLoopOpts, LLMStepOpts, LLMWithModelOpts, LLMWithResponseOpts, LLMWithToolsOpts, ModuleChecksOpts, ModuleGeneratorsOpts, ModuleServeOpts, ModuleServicesOpts, Node, PipelineLabel, Platform, PortForward, ServiceEndpointOpts, ServiceStopOpts, ServiceTerminalOpts, ServiceUpOpts, Syncer, TypeDefWithEnumMemberOpts, TypeDefWithEnumOpts, TypeDefWithEnumValueOpts, TypeDefWithFieldOpts, TypeDefWithInterfaceOpts, TypeDefWithObjectOpts, TypeDefWithScalarOpts, Void, WorkspaceAgentsOpts, WorkspaceChangesOpts, WorkspaceChecksOpts, WorkspaceConfigReadOpts, WorkspaceDirectoryOpts, WorkspaceFindRootsOpts, WorkspaceFindUpOpts, WorkspaceGeneratorsOpts, WorkspaceSearchOpts, WorkspaceServicesOpts, WorkspaceWithConfigEnvOpts, WorkspaceWithConfigValueOpts, WorkspaceWithInitClientOpts, WorkspaceWithInitModuleOpts, WorkspaceWithModuleOpts, WorkspaceWithNewFileOpts, WorkspaceWithSdkOpts, WorkspaceWithoutConfigEnvOpts, WorkspaceWithoutConfigValueOpts, WorkspaceWithoutModuleOpts, WorkspaceWithoutSdkOpts, __DirectiveArgsOpts, __FieldArgsOpts, __TypeEnumValuesOpts, __TypeFieldsOpts, __TypeInputFieldsOpts, float }; diff --git a/library/bundle/core.js b/library/bundle/core.js index c1e2ed9..565177e 100644 --- a/library/bundle/core.js +++ b/library/bundle/core.js @@ -59351,12 +59351,1381 @@ var require_src27 = __commonJS((exports) => { } }); }); +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.js +var require_suppress_tracing2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isTracingSuppressed = exports.unsuppressTracing = exports.suppressTracing = undefined; + var api_1 = require_src(); + var SUPPRESS_TRACING_KEY = (0, api_1.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING"); + function suppressTracing(context) { + return context.setValue(SUPPRESS_TRACING_KEY, true); + } + exports.suppressTracing = suppressTracing; + function unsuppressTracing(context) { + return context.deleteValue(SUPPRESS_TRACING_KEY); + } + exports.unsuppressTracing = unsuppressTracing; + function isTracingSuppressed(context) { + return context.getValue(SUPPRESS_TRACING_KEY) === true; + } + exports.isTracingSuppressed = isTracingSuppressed; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/constants.js +var require_constants4 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.BAGGAGE_MAX_TOTAL_LENGTH = exports.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = exports.BAGGAGE_MAX_NAME_VALUE_PAIRS = exports.BAGGAGE_HEADER = exports.BAGGAGE_ITEMS_SEPARATOR = exports.BAGGAGE_PROPERTIES_SEPARATOR = exports.BAGGAGE_KEY_PAIR_SEPARATOR = undefined; + exports.BAGGAGE_KEY_PAIR_SEPARATOR = "="; + exports.BAGGAGE_PROPERTIES_SEPARATOR = ";"; + exports.BAGGAGE_ITEMS_SEPARATOR = ","; + exports.BAGGAGE_HEADER = "baggage"; + exports.BAGGAGE_MAX_NAME_VALUE_PAIRS = 180; + exports.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096; + exports.BAGGAGE_MAX_TOTAL_LENGTH = 8192; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/utils.js +var require_utils13 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseKeyPairsIntoRecord = exports.parseBaggageHeaderString = exports.parsePairKeyValue = exports.getKeyPairs = exports.serializeKeyPairs = undefined; + var api_1 = require_src(); + var constants_1 = require_constants4(); + function serializeKeyPairs(keyPairs) { + return keyPairs.reduce((hValue, current) => { + const value = `${hValue}${hValue !== "" ? constants_1.BAGGAGE_ITEMS_SEPARATOR : ""}${current}`; + return value.length > constants_1.BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value; + }, ""); + } + exports.serializeKeyPairs = serializeKeyPairs; + function getKeyPairs(baggage) { + return baggage.getAllEntries().map(([key, value]) => { + let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`; + if (value.metadata !== undefined) { + entry += constants_1.BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString(); + } + return entry; + }); + } + exports.getKeyPairs = getKeyPairs; + function parsePairKeyValue(entry) { + if (!entry) + return; + const metadataSeparatorIndex = entry.indexOf(constants_1.BAGGAGE_PROPERTIES_SEPARATOR); + const keyPairPart = metadataSeparatorIndex === -1 ? entry : entry.substring(0, metadataSeparatorIndex); + const separatorIndex = keyPairPart.indexOf(constants_1.BAGGAGE_KEY_PAIR_SEPARATOR); + if (separatorIndex <= 0) + return; + const rawKey = keyPairPart.substring(0, separatorIndex).trim(); + const rawValue = keyPairPart.substring(separatorIndex + 1).trim(); + if (!rawKey || !rawValue) + return; + let key; + let value; + try { + key = decodeURIComponent(rawKey); + value = decodeURIComponent(rawValue); + } catch { + return; + } + let metadata; + if (metadataSeparatorIndex !== -1 && metadataSeparatorIndex < entry.length - 1) { + const metadataString = entry.substring(metadataSeparatorIndex + 1); + metadata = (0, api_1.baggageEntryMetadataFromString)(metadataString); + } + return { key, value, metadata }; + } + exports.parsePairKeyValue = parsePairKeyValue; + function parseBaggageHeaderString(value, baggage, count, totalSize) { + let start = 0; + while (start < value.length && count < constants_1.BAGGAGE_MAX_NAME_VALUE_PAIRS) { + const end = value.indexOf(constants_1.BAGGAGE_ITEMS_SEPARATOR, start); + const entryEnd = end === -1 ? value.length : end; + const entryLength = entryEnd - start; + if (entryLength <= constants_1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS) { + const keyPair = parsePairKeyValue(value.substring(start, entryEnd)); + if (keyPair) { + const entrySize = (count === 0 ? 0 : 1) + entryLength; + if (totalSize + entrySize > constants_1.BAGGAGE_MAX_TOTAL_LENGTH) + break; + baggage[keyPair.key] = keyPair.metadata ? { value: keyPair.value, metadata: keyPair.metadata } : { value: keyPair.value }; + count++; + totalSize += entrySize; + } + } + if (end === -1) + break; + start = end + 1; + } + return [count, totalSize]; + } + exports.parseBaggageHeaderString = parseBaggageHeaderString; + function parseKeyPairsIntoRecord(value) { + const result = {}; + if (typeof value === "string" && value.length > 0) { + value.split(constants_1.BAGGAGE_ITEMS_SEPARATOR).forEach((entry) => { + const keyPair = parsePairKeyValue(entry); + if (keyPair !== undefined && keyPair.value.length > 0) { + result[keyPair.key] = keyPair.value; + } + }); + } + return result; + } + exports.parseKeyPairsIntoRecord = parseKeyPairsIntoRecord; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js +var require_W3CBaggagePropagator2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.W3CBaggagePropagator = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + var constants_1 = require_constants4(); + var utils_1 = require_utils13(); + + class W3CBaggagePropagator { + inject(context, carrier, setter) { + const baggage = api_1.propagation.getBaggage(context); + if (!baggage || (0, suppress_tracing_1.isTracingSuppressed)(context)) + return; + const keyPairs = (0, utils_1.getKeyPairs)(baggage).filter((pair) => { + return pair.length <= constants_1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS; + }).slice(0, constants_1.BAGGAGE_MAX_NAME_VALUE_PAIRS); + const headerValue = (0, utils_1.serializeKeyPairs)(keyPairs); + if (headerValue.length > 0) { + setter.set(carrier, constants_1.BAGGAGE_HEADER, headerValue); + } + } + extract(context, carrier, getter) { + const headerValue = getter.get(carrier, constants_1.BAGGAGE_HEADER); + if (!headerValue) { + return context; + } + const baggage = {}; + let count = 0; + let totalSize = 0; + if (Array.isArray(headerValue)) { + for (let i = 0;i < headerValue.length; i++) { + [count, totalSize] = (0, utils_1.parseBaggageHeaderString)(headerValue[i], baggage, count, totalSize); + } + } else { + [count] = (0, utils_1.parseBaggageHeaderString)(headerValue, baggage, count, totalSize); + } + if (count === 0) { + return context; + } + return api_1.propagation.setBaggage(context, api_1.propagation.createBaggage(baggage)); + } + fields() { + return [constants_1.BAGGAGE_HEADER]; + } + } + exports.W3CBaggagePropagator = W3CBaggagePropagator; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/anchored-clock.js +var require_anchored_clock2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AnchoredClock = undefined; + + class AnchoredClock { + _monotonicClock; + _epochMillis; + _performanceMillis; + constructor(systemClock, monotonicClock) { + this._monotonicClock = monotonicClock; + this._epochMillis = systemClock.now(); + this._performanceMillis = monotonicClock.now(); + } + now() { + const delta = this._monotonicClock.now() - this._performanceMillis; + return this._epochMillis + delta; + } + } + exports.AnchoredClock = AnchoredClock; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/attributes.js +var require_attributes2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isAttributeValue = exports.isAttributeKey = exports.sanitizeAttributes = undefined; + var api_1 = require_src(); + function sanitizeAttributes(attributes) { + const out = {}; + if (typeof attributes !== "object" || attributes == null) { + return out; + } + for (const key in attributes) { + if (!Object.prototype.hasOwnProperty.call(attributes, key)) { + continue; + } + if (!isAttributeKey(key)) { + api_1.diag.warn(`Invalid attribute key: ${key}`); + continue; + } + const val = attributes[key]; + if (!isAttributeValue(val)) { + api_1.diag.warn(`Invalid attribute value set for key: ${key}`); + continue; + } + if (Array.isArray(val)) { + out[key] = val.slice(); + } else { + out[key] = val; + } + } + return out; + } + exports.sanitizeAttributes = sanitizeAttributes; + function isAttributeKey(key) { + return typeof key === "string" && key !== ""; + } + exports.isAttributeKey = isAttributeKey; + function isAttributeValue(val) { + if (val == null) { + return true; + } + if (Array.isArray(val)) { + return isHomogeneousAttributeValueArray(val); + } + return isValidPrimitiveAttributeValueType(typeof val); + } + exports.isAttributeValue = isAttributeValue; + function isHomogeneousAttributeValueArray(arr) { + let type; + for (const element of arr) { + if (element == null) + continue; + const elementType = typeof element; + if (elementType === type) { + continue; + } + if (!type) { + if (isValidPrimitiveAttributeValueType(elementType)) { + type = elementType; + continue; + } + return false; + } + return false; + } + return true; + } + function isValidPrimitiveAttributeValueType(valType) { + switch (valType) { + case "number": + case "boolean": + case "string": + return true; + } + return false; + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.js +var require_logging_error_handler2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.loggingErrorHandler = undefined; + var api_1 = require_src(); + function loggingErrorHandler() { + return (ex) => { + api_1.diag.error(stringifyException(ex)); + }; + } + exports.loggingErrorHandler = loggingErrorHandler; + function stringifyException(ex) { + if (typeof ex === "string") { + return ex; + } else { + return JSON.stringify(flattenException(ex)); + } + } + function flattenException(ex) { + const result = {}; + let current = ex; + while (current !== null) { + Object.getOwnPropertyNames(current).forEach((propertyName) => { + if (result[propertyName]) + return; + const value = current[propertyName]; + if (value) { + result[propertyName] = String(value); + } + }); + current = Object.getPrototypeOf(current); + } + return result; + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/global-error-handler.js +var require_global_error_handler2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.globalErrorHandler = exports.setGlobalErrorHandler = undefined; + var logging_error_handler_1 = require_logging_error_handler2(); + var delegateHandler = (0, logging_error_handler_1.loggingErrorHandler)(); + function setGlobalErrorHandler(handler) { + delegateHandler = handler; + } + exports.setGlobalErrorHandler = setGlobalErrorHandler; + function globalErrorHandler(ex) { + try { + delegateHandler(ex); + } catch {} + } + exports.globalErrorHandler = globalErrorHandler; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/environment.js +var require_environment3 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getStringListFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = exports.getNumberFromEnv = undefined; + var api_1 = require_src(); + var util_1 = __require("util"); + function getNumberFromEnv(key) { + const raw = process.env[key]; + if (raw == null || raw.trim() === "") { + return; + } + const value = Number(raw); + if (isNaN(value)) { + api_1.diag.warn(`Unknown value ${(0, util_1.inspect)(raw)} for ${key}, expected a number, using defaults`); + return; + } + return value; + } + exports.getNumberFromEnv = getNumberFromEnv; + function getStringFromEnv(key) { + const raw = process.env[key]; + if (raw == null || raw.trim() === "") { + return; + } + return raw; + } + exports.getStringFromEnv = getStringFromEnv; + function getBooleanFromEnv(key) { + const raw = process.env[key]?.trim().toLowerCase(); + if (raw == null || raw === "") { + return false; + } + if (raw === "true") { + return true; + } else if (raw === "false") { + return false; + } else { + api_1.diag.warn(`Unknown value ${(0, util_1.inspect)(raw)} for ${key}, expected 'true' or 'false', falling back to 'false' (default)`); + return false; + } + } + exports.getBooleanFromEnv = getBooleanFromEnv; + function getStringListFromEnv(key) { + return getStringFromEnv(key)?.split(",").map((v) => v.trim()).filter((s) => s !== ""); + } + exports.getStringListFromEnv = getStringListFromEnv; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/globalThis.js +var require_globalThis2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports._globalThis = undefined; + exports._globalThis = globalThis; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/version.js +var require_version9 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.VERSION = undefined; + exports.VERSION = "2.9.0"; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/semconv.js +var require_semconv7 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ATTR_PROCESS_RUNTIME_NAME = undefined; + exports.ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name"; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/sdk-info.js +var require_sdk_info2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SDK_INFO = undefined; + var version_1 = require_version9(); + var semantic_conventions_1 = require_src2(); + var semconv_1 = require_semconv7(); + exports.SDK_INFO = { + [semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME]: "opentelemetry", + [semconv_1.ATTR_PROCESS_RUNTIME_NAME]: "node", + [semantic_conventions_1.ATTR_TELEMETRY_SDK_LANGUAGE]: semantic_conventions_1.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS, + [semantic_conventions_1.ATTR_TELEMETRY_SDK_VERSION]: version_1.VERSION + }; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/index.js +var require_node12 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.otperformance = exports.SDK_INFO = exports._globalThis = exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = undefined; + var environment_1 = require_environment3(); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return environment_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return environment_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return environment_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return environment_1.getStringListFromEnv; + } }); + var globalThis_1 = require_globalThis2(); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return globalThis_1._globalThis; + } }); + var sdk_info_1 = require_sdk_info2(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return sdk_info_1.SDK_INFO; + } }); + exports.otperformance = performance; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/index.js +var require_platform11 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getStringFromEnv = exports.getBooleanFromEnv = exports.otperformance = exports._globalThis = exports.SDK_INFO = undefined; + var node_1 = require_node12(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return node_1.SDK_INFO; + } }); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return node_1._globalThis; + } }); + Object.defineProperty(exports, "otperformance", { enumerable: true, get: function() { + return node_1.otperformance; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return node_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return node_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return node_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return node_1.getStringListFromEnv; + } }); +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/time.js +var require_time2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.addHrTimes = exports.isTimeInput = exports.isTimeInputHrTime = exports.hrTimeToSeconds = exports.hrTimeToMilliseconds = exports.hrTimeToMicroseconds = exports.hrTimeToNanoseconds = exports.hrTimeToTimeStamp = exports.hrTimeDuration = exports.timeInputToHrTime = exports.hrTime = exports.getTimeOrigin = exports.millisToHrTime = undefined; + var platform_1 = require_platform11(); + var NANOSECOND_DIGITS = 9; + var NANOSECOND_DIGITS_IN_MILLIS = 6; + var MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS); + var SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS); + function millisToHrTime(epochMillis) { + const epochSeconds = epochMillis / 1000; + const seconds = Math.trunc(epochSeconds); + const nanos = Math.round(epochMillis % 1000 * MILLISECONDS_TO_NANOSECONDS); + return [seconds, nanos]; + } + exports.millisToHrTime = millisToHrTime; + function getTimeOrigin() { + return platform_1.otperformance.timeOrigin; + } + exports.getTimeOrigin = getTimeOrigin; + function hrTime(performanceNow) { + const timeOrigin = millisToHrTime(platform_1.otperformance.timeOrigin); + const now = millisToHrTime(typeof performanceNow === "number" ? performanceNow : platform_1.otperformance.now()); + return addHrTimes(timeOrigin, now); + } + exports.hrTime = hrTime; + function timeInputToHrTime(time) { + if (isTimeInputHrTime(time)) { + return time; + } else if (typeof time === "number") { + if (time < platform_1.otperformance.timeOrigin / 2) { + return hrTime(time); + } else { + return millisToHrTime(time); + } + } else if (time instanceof Date) { + return millisToHrTime(time.getTime()); + } else { + throw TypeError("Invalid input type"); + } + } + exports.timeInputToHrTime = timeInputToHrTime; + function hrTimeDuration(startTime, endTime) { + let seconds = endTime[0] - startTime[0]; + let nanos = endTime[1] - startTime[1]; + if (nanos < 0) { + seconds -= 1; + nanos += SECOND_TO_NANOSECONDS; + } + return [seconds, nanos]; + } + exports.hrTimeDuration = hrTimeDuration; + function hrTimeToTimeStamp(time) { + const precision = NANOSECOND_DIGITS; + const tmp = `${"0".repeat(precision)}${time[1]}Z`; + const nanoString = tmp.substring(tmp.length - precision - 1); + const date = new Date(time[0] * 1000).toISOString(); + return date.replace("000Z", nanoString); + } + exports.hrTimeToTimeStamp = hrTimeToTimeStamp; + function hrTimeToNanoseconds(time) { + return time[0] * SECOND_TO_NANOSECONDS + time[1]; + } + exports.hrTimeToNanoseconds = hrTimeToNanoseconds; + function hrTimeToMicroseconds(time) { + return time[0] * 1e6 + time[1] / 1000; + } + exports.hrTimeToMicroseconds = hrTimeToMicroseconds; + function hrTimeToMilliseconds(time) { + return time[0] * 1000 + time[1] / 1e6; + } + exports.hrTimeToMilliseconds = hrTimeToMilliseconds; + function hrTimeToSeconds(time) { + return time[0] + time[1] / SECOND_TO_NANOSECONDS; + } + exports.hrTimeToSeconds = hrTimeToSeconds; + function isTimeInputHrTime(value) { + return Array.isArray(value) && value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number"; + } + exports.isTimeInputHrTime = isTimeInputHrTime; + function isTimeInput(value) { + return isTimeInputHrTime(value) || typeof value === "number" || value instanceof Date; + } + exports.isTimeInput = isTimeInput; + function addHrTimes(time1, time2) { + const out = [time1[0] + time2[0], time1[1] + time2[1]]; + if (out[1] >= SECOND_TO_NANOSECONDS) { + out[1] -= SECOND_TO_NANOSECONDS; + out[0] += 1; + } + return out; + } + exports.addHrTimes = addHrTimes; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/timer-util.js +var require_timer_util2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.unrefTimer = undefined; + function unrefTimer(timer) { + if (typeof timer !== "number") { + timer.unref(); + } + } + exports.unrefTimer = unrefTimer; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/ExportResult.js +var require_ExportResult2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExportResultCode = undefined; + var ExportResultCode; + (function(ExportResultCode2) { + ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS"; + ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED"; + })(ExportResultCode = exports.ExportResultCode || (exports.ExportResultCode = {})); +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/propagation/composite.js +var require_composite2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CompositePropagator = undefined; + var api_1 = require_src(); + + class CompositePropagator { + _propagators; + _fields; + constructor(config = {}) { + this._propagators = config.propagators ?? []; + const fields = new Set; + for (const propagator of this._propagators) { + const propagatorFields = typeof propagator.fields === "function" ? propagator.fields() : []; + for (const field of propagatorFields) { + fields.add(field); + } + } + this._fields = Array.from(fields); + } + inject(context, carrier, setter) { + for (const propagator of this._propagators) { + try { + propagator.inject(context, carrier, setter); + } catch (err) { + api_1.diag.warn(`Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`); + } + } + } + extract(context, carrier, getter) { + return this._propagators.reduce((ctx, propagator) => { + try { + return propagator.extract(ctx, carrier, getter); + } catch (err) { + api_1.diag.warn(`Failed to extract with ${propagator.constructor.name}. Err: ${err.message}`); + } + return ctx; + }, context); + } + fields() { + return this._fields.slice(); + } + } + exports.CompositePropagator = CompositePropagator; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/internal/validators.js +var require_validators2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.validateValue = exports.validateKey = undefined; + var VALID_KEY_CHAR_RANGE = "[_0-9a-z-*/]"; + var VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`; + var VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`; + var VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`); + var VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/; + var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/; + function validateKey(key) { + return VALID_KEY_REGEX.test(key); + } + exports.validateKey = validateKey; + function validateValue(value) { + return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value); + } + exports.validateValue = validateValue; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/TraceState.js +var require_TraceState2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TraceState = undefined; + var validators_1 = require_validators2(); + var MAX_TRACE_STATE_ITEMS = 32; + var MAX_TRACE_STATE_LEN = 512; + var LIST_MEMBERS_SEPARATOR = ","; + var LIST_MEMBER_KEY_VALUE_SPLITTER = "="; + + class TraceState { + _length; + _rawTraceState; + _internalState; + constructor(rawTraceState) { + this._rawTraceState = typeof rawTraceState === "string" ? rawTraceState : ""; + this._length = this._rawTraceState.length; + } + set(key, value) { + if (!(0, validators_1.validateKey)(key) || !(0, validators_1.validateValue)(value)) { + return this; + } + const currState = this._getState(); + const currValue = currState.get(key); + let newLength = this._length; + if (typeof currValue === "string") { + newLength += value.length - currValue.length; + } else { + newLength += key.length + value.length + (currState.size > 0 ? 2 : 1); + } + if (newLength > MAX_TRACE_STATE_LEN) { + return this; + } + const newState = new Map(currState); + newState.delete(key); + newState.set(key, value); + return this._fromState(newState, newLength); + } + unset(key) { + const currState = this._getState(); + const currValue = currState.get(key); + if (typeof currValue !== "string") { + return this; + } + let newLength = this._length - (key.length + currValue.length + 1); + if (currState.size > 1) { + newLength = newLength - 1; + } + const newState = new Map(currState); + newState.delete(key); + return this._fromState(newState, newLength); + } + get(key) { + const currState = this._getState(); + return currState.get(key); + } + serialize() { + let serialized = ""; + let index = 0; + for (const entry of this._getState()) { + if (index > 0) { + serialized = LIST_MEMBERS_SEPARATOR + serialized; + } + serialized = `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized; + index++; + } + return serialized; + } + _getState() { + if (this._internalState) { + return this._internalState; + } + const vendorMembers = this._rawTraceState.split(LIST_MEMBERS_SEPARATOR); + const vendorEntries = new Map; + let currentLength = 0; + for (const member of vendorMembers) { + const m = member.trim(); + const idx = m.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER); + if (idx === -1) { + continue; + } + const key = m.slice(0, idx); + const value = m.slice(idx + 1); + if (!(0, validators_1.validateKey)(key) || !(0, validators_1.validateValue)(value)) { + continue; + } + const futureLength = currentLength + m.length + (vendorEntries.size > 0 ? 1 : 0); + if (futureLength > MAX_TRACE_STATE_LEN) { + continue; + } + vendorEntries.set(key, value); + currentLength = futureLength; + if (vendorEntries.size >= MAX_TRACE_STATE_ITEMS) { + break; + } + } + this._length = currentLength; + this._internalState = new Map(Array.from(vendorEntries.entries()).reverse()); + return this._internalState; + } + _fromState(state, length) { + const traceState = Object.create(TraceState.prototype); + traceState._internalState = state; + traceState._length = length; + return traceState; + } + } + exports.TraceState = TraceState; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.js +var require_W3CTraceContextPropagator2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.W3CTraceContextPropagator = exports.parseTraceParent = exports.TRACE_STATE_HEADER = exports.TRACE_PARENT_HEADER = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + var TraceState_1 = require_TraceState2(); + exports.TRACE_PARENT_HEADER = "traceparent"; + exports.TRACE_STATE_HEADER = "tracestate"; + var VERSION = "00"; + var VERSION_PART = "(?!ff)[\\da-f]{2}"; + var TRACE_ID_PART = "(?![0]{32})[\\da-f]{32}"; + var PARENT_ID_PART = "(?![0]{16})[\\da-f]{16}"; + var FLAGS_PART = "[\\da-f]{2}"; + var TRACE_PARENT_REGEX = new RegExp(`^\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\s?$`); + function parseTraceParent(traceParent) { + const match = TRACE_PARENT_REGEX.exec(traceParent); + if (!match) + return null; + if (match[1] === "00" && match[5]) + return null; + return { + traceId: match[2], + spanId: match[3], + traceFlags: parseInt(match[4], 16) + }; + } + exports.parseTraceParent = parseTraceParent; + + class W3CTraceContextPropagator { + inject(context, carrier, setter) { + const spanContext = api_1.trace.getSpanContext(context); + if (!spanContext || (0, suppress_tracing_1.isTracingSuppressed)(context) || !(0, api_1.isSpanContextValid)(spanContext)) + return; + const traceParent = `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-0${Number(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`; + setter.set(carrier, exports.TRACE_PARENT_HEADER, traceParent); + if (spanContext.traceState) { + setter.set(carrier, exports.TRACE_STATE_HEADER, spanContext.traceState.serialize()); + } + } + extract(context, carrier, getter) { + const traceParentHeader = getter.get(carrier, exports.TRACE_PARENT_HEADER); + if (!traceParentHeader) + return context; + const traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader; + if (typeof traceParent !== "string") + return context; + const spanContext = parseTraceParent(traceParent); + if (!spanContext) + return context; + spanContext.isRemote = true; + const traceStateHeader = getter.get(carrier, exports.TRACE_STATE_HEADER); + if (traceStateHeader) { + const state = Array.isArray(traceStateHeader) ? traceStateHeader.join(",") : traceStateHeader; + spanContext.traceState = new TraceState_1.TraceState(typeof state === "string" ? state : undefined); + } + return api_1.trace.setSpanContext(context, spanContext); + } + fields() { + return [exports.TRACE_PARENT_HEADER, exports.TRACE_STATE_HEADER]; + } + } + exports.W3CTraceContextPropagator = W3CTraceContextPropagator; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.js +var require_rpc_metadata2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getRPCMetadata = exports.deleteRPCMetadata = exports.setRPCMetadata = exports.RPCType = undefined; + var api_1 = require_src(); + var RPC_METADATA_KEY = (0, api_1.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"); + var RPCType; + (function(RPCType2) { + RPCType2["HTTP"] = "http"; + })(RPCType = exports.RPCType || (exports.RPCType = {})); + function setRPCMetadata(context, meta) { + return context.setValue(RPC_METADATA_KEY, meta); + } + exports.setRPCMetadata = setRPCMetadata; + function deleteRPCMetadata(context) { + return context.deleteValue(RPC_METADATA_KEY); + } + exports.deleteRPCMetadata = deleteRPCMetadata; + function getRPCMetadata(context) { + return context.getValue(RPC_METADATA_KEY); + } + exports.getRPCMetadata = getRPCMetadata; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/lodash.merge.js +var require_lodash_merge2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isPlainObject = undefined; + var objectTag = "[object Object]"; + var nullTag = "[object Null]"; + var undefinedTag = "[object Undefined]"; + var funcProto = Function.prototype; + var funcToString = funcProto.toString; + var objectCtorString = funcToString.call(Object); + var getPrototypeOf = Object.getPrototypeOf; + var objectProto = Object.prototype; + var hasOwnProperty = objectProto.hasOwnProperty; + var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + var nativeObjectToString = objectProto.toString; + function isPlainObject2(value) { + if (!isObjectLike(value) || baseGetTag(value) !== objectTag) { + return false; + } + const proto = getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) === objectCtorString; + } + exports.isPlainObject = isPlainObject2; + function isObjectLike(value) { + return value != null && typeof value == "object"; + } + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); + } + function getRawTag(value) { + const isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; + let unmasked = false; + try { + value[symToStringTag] = undefined; + unmasked = true; + } catch {} + const result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + function objectToString(value) { + return nativeObjectToString.call(value); + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/merge.js +var require_merge2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.merge = undefined; + var lodash_merge_1 = require_lodash_merge2(); + var MAX_LEVEL = 20; + function merge(...args) { + let result = args.shift(); + const objects = new WeakMap; + while (args.length > 0) { + result = mergeTwoObjects(result, args.shift(), 0, objects); + } + return result; + } + exports.merge = merge; + function takeValue(value) { + if (isArray(value)) { + return value.slice(); + } + return value; + } + function mergeTwoObjects(one, two, level = 0, objects) { + let result; + if (level > MAX_LEVEL) { + return; + } + level++; + if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) { + result = takeValue(two); + } else if (isArray(one)) { + result = one.slice(); + if (isArray(two)) { + for (let i = 0, j = two.length;i < j; i++) { + result.push(takeValue(two[i])); + } + } else if (isObject(two)) { + const keys = Object.keys(two); + for (let i = 0, j = keys.length;i < j; i++) { + const key = keys[i]; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + continue; + } + result[key] = takeValue(two[key]); + } + } + } else if (isObject(one)) { + if (isObject(two)) { + if (!shouldMerge(one, two)) { + return two; + } + result = Object.assign({}, one); + const keys = Object.keys(two); + for (let i = 0, j = keys.length;i < j; i++) { + const key = keys[i]; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + continue; + } + const twoValue = two[key]; + if (isPrimitive(twoValue)) { + if (typeof twoValue === "undefined") { + delete result[key]; + } else { + result[key] = twoValue; + } + } else { + const obj1 = result[key]; + const obj2 = twoValue; + if (wasObjectReferenced(one, key, objects) || wasObjectReferenced(two, key, objects)) { + delete result[key]; + } else { + if (isObject(obj1) && isObject(obj2)) { + const arr1 = objects.get(obj1) || []; + const arr2 = objects.get(obj2) || []; + arr1.push({ obj: one, key }); + arr2.push({ obj: two, key }); + objects.set(obj1, arr1); + objects.set(obj2, arr2); + } + result[key] = mergeTwoObjects(result[key], twoValue, level, objects); + } + } + } + } else { + result = two; + } + } + return result; + } + function wasObjectReferenced(obj, key, objects) { + const arr = objects.get(obj[key]) || []; + for (let i = 0, j = arr.length;i < j; i++) { + const info = arr[i]; + if (info.key === key && info.obj === obj) { + return true; + } + } + return false; + } + function isArray(value) { + return Array.isArray(value); + } + function isFunction(value) { + return typeof value === "function"; + } + function isObject(value) { + return !isPrimitive(value) && !isArray(value) && !isFunction(value) && typeof value === "object"; + } + function isPrimitive(value) { + return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "undefined" || value instanceof Date || value instanceof RegExp || value === null; + } + function shouldMerge(one, two) { + if (!(0, lodash_merge_1.isPlainObject)(one) || !(0, lodash_merge_1.isPlainObject)(two)) { + return false; + } + return true; + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/timeout.js +var require_timeout2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.callWithTimeout = exports.TimeoutError = undefined; + + class TimeoutError extends Error { + constructor(message) { + super(message); + Object.setPrototypeOf(this, TimeoutError.prototype); + } + } + exports.TimeoutError = TimeoutError; + function callWithTimeout(promise, timeout) { + let timeoutHandle; + const timeoutPromise = new Promise(function timeoutFunction(_resolve, reject) { + timeoutHandle = setTimeout(function timeoutHandler() { + reject(new TimeoutError("Operation timed out.")); + }, timeout); + }); + return Promise.race([promise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle); + return result; + }, (reason) => { + clearTimeout(timeoutHandle); + throw reason; + }); + } + exports.callWithTimeout = callWithTimeout; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/url.js +var require_url2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isUrlIgnored = exports.urlMatches = undefined; + function urlMatches(url, urlToMatch) { + if (typeof urlToMatch === "string") { + return url === urlToMatch; + } else { + return !!url.match(urlToMatch); + } + } + exports.urlMatches = urlMatches; + function isUrlIgnored(url, ignoredUrls) { + if (!ignoredUrls) { + return false; + } + for (const ignoreUrl of ignoredUrls) { + if (urlMatches(url, ignoreUrl)) { + return true; + } + } + return false; + } + exports.isUrlIgnored = isUrlIgnored; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/promise.js +var require_promise2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Deferred = undefined; + + class Deferred { + _promise; + _resolve; + _reject; + constructor() { + this._promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + }); + } + get promise() { + return this._promise; + } + resolve(val) { + this._resolve(val); + } + reject(err) { + this._reject(err); + } + } + exports.Deferred = Deferred; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/callback.js +var require_callback2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.BindOnceFuture = undefined; + var promise_1 = require_promise2(); + + class BindOnceFuture { + _isCalled = false; + _deferred = new promise_1.Deferred; + _callback; + _that; + constructor(callback, that) { + this._callback = callback; + this._that = that; + } + get isCalled() { + return this._isCalled; + } + get promise() { + return this._deferred.promise; + } + call(...args) { + if (!this._isCalled) { + this._isCalled = true; + try { + Promise.resolve(this._callback.call(this._that, ...args)).then((val) => this._deferred.resolve(val), (err) => this._deferred.reject(err)); + } catch (err) { + this._deferred.reject(err); + } + } + return this._deferred.promise; + } + } + exports.BindOnceFuture = BindOnceFuture; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/configuration.js +var require_configuration2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.diagLogLevelFromString = undefined; + var api_1 = require_src(); + var logLevelMap = { + ALL: api_1.DiagLogLevel.ALL, + VERBOSE: api_1.DiagLogLevel.VERBOSE, + DEBUG: api_1.DiagLogLevel.DEBUG, + INFO: api_1.DiagLogLevel.INFO, + WARN: api_1.DiagLogLevel.WARN, + ERROR: api_1.DiagLogLevel.ERROR, + NONE: api_1.DiagLogLevel.NONE + }; + function diagLogLevelFromString(value) { + if (value == null) { + return; + } + const resolvedLogLevel = logLevelMap[value.toUpperCase()]; + if (resolvedLogLevel == null) { + api_1.diag.warn(`Unknown log level "${value}", expected one of ${Object.keys(logLevelMap)}, using default`); + return api_1.DiagLogLevel.INFO; + } + return resolvedLogLevel; + } + exports.diagLogLevelFromString = diagLogLevelFromString; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/internal/exporter.js +var require_exporter2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports._export = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + function _export(exporter, arg) { + return new Promise((resolve) => { + api_1.context.with((0, suppress_tracing_1.suppressTracing)(api_1.context.active()), () => { + exporter.export(arg, resolve); + }); + }); + } + exports._export = _export; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/index.js +var require_src28 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.diagLogLevelFromString = exports.BindOnceFuture = exports.urlMatches = exports.isUrlIgnored = exports.callWithTimeout = exports.TimeoutError = exports.merge = exports.TraceState = exports.unsuppressTracing = exports.suppressTracing = exports.isTracingSuppressed = exports.setRPCMetadata = exports.getRPCMetadata = exports.deleteRPCMetadata = exports.RPCType = exports.parseTraceParent = exports.W3CTraceContextPropagator = exports.TRACE_STATE_HEADER = exports.TRACE_PARENT_HEADER = exports.CompositePropagator = exports.otperformance = exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = exports._globalThis = exports.SDK_INFO = exports.parseKeyPairsIntoRecord = exports.ExportResultCode = exports.unrefTimer = exports.timeInputToHrTime = exports.millisToHrTime = exports.isTimeInputHrTime = exports.isTimeInput = exports.hrTimeToTimeStamp = exports.hrTimeToSeconds = exports.hrTimeToNanoseconds = exports.hrTimeToMilliseconds = exports.hrTimeToMicroseconds = exports.hrTimeDuration = exports.hrTime = exports.getTimeOrigin = exports.addHrTimes = exports.loggingErrorHandler = exports.setGlobalErrorHandler = exports.globalErrorHandler = exports.sanitizeAttributes = exports.isAttributeValue = exports.AnchoredClock = exports.W3CBaggagePropagator = undefined; + exports.internal = undefined; + var W3CBaggagePropagator_1 = require_W3CBaggagePropagator2(); + Object.defineProperty(exports, "W3CBaggagePropagator", { enumerable: true, get: function() { + return W3CBaggagePropagator_1.W3CBaggagePropagator; + } }); + var anchored_clock_1 = require_anchored_clock2(); + Object.defineProperty(exports, "AnchoredClock", { enumerable: true, get: function() { + return anchored_clock_1.AnchoredClock; + } }); + var attributes_1 = require_attributes2(); + Object.defineProperty(exports, "isAttributeValue", { enumerable: true, get: function() { + return attributes_1.isAttributeValue; + } }); + Object.defineProperty(exports, "sanitizeAttributes", { enumerable: true, get: function() { + return attributes_1.sanitizeAttributes; + } }); + var global_error_handler_1 = require_global_error_handler2(); + Object.defineProperty(exports, "globalErrorHandler", { enumerable: true, get: function() { + return global_error_handler_1.globalErrorHandler; + } }); + Object.defineProperty(exports, "setGlobalErrorHandler", { enumerable: true, get: function() { + return global_error_handler_1.setGlobalErrorHandler; + } }); + var logging_error_handler_1 = require_logging_error_handler2(); + Object.defineProperty(exports, "loggingErrorHandler", { enumerable: true, get: function() { + return logging_error_handler_1.loggingErrorHandler; + } }); + var time_1 = require_time2(); + Object.defineProperty(exports, "addHrTimes", { enumerable: true, get: function() { + return time_1.addHrTimes; + } }); + Object.defineProperty(exports, "getTimeOrigin", { enumerable: true, get: function() { + return time_1.getTimeOrigin; + } }); + Object.defineProperty(exports, "hrTime", { enumerable: true, get: function() { + return time_1.hrTime; + } }); + Object.defineProperty(exports, "hrTimeDuration", { enumerable: true, get: function() { + return time_1.hrTimeDuration; + } }); + Object.defineProperty(exports, "hrTimeToMicroseconds", { enumerable: true, get: function() { + return time_1.hrTimeToMicroseconds; + } }); + Object.defineProperty(exports, "hrTimeToMilliseconds", { enumerable: true, get: function() { + return time_1.hrTimeToMilliseconds; + } }); + Object.defineProperty(exports, "hrTimeToNanoseconds", { enumerable: true, get: function() { + return time_1.hrTimeToNanoseconds; + } }); + Object.defineProperty(exports, "hrTimeToSeconds", { enumerable: true, get: function() { + return time_1.hrTimeToSeconds; + } }); + Object.defineProperty(exports, "hrTimeToTimeStamp", { enumerable: true, get: function() { + return time_1.hrTimeToTimeStamp; + } }); + Object.defineProperty(exports, "isTimeInput", { enumerable: true, get: function() { + return time_1.isTimeInput; + } }); + Object.defineProperty(exports, "isTimeInputHrTime", { enumerable: true, get: function() { + return time_1.isTimeInputHrTime; + } }); + Object.defineProperty(exports, "millisToHrTime", { enumerable: true, get: function() { + return time_1.millisToHrTime; + } }); + Object.defineProperty(exports, "timeInputToHrTime", { enumerable: true, get: function() { + return time_1.timeInputToHrTime; + } }); + var timer_util_1 = require_timer_util2(); + Object.defineProperty(exports, "unrefTimer", { enumerable: true, get: function() { + return timer_util_1.unrefTimer; + } }); + var ExportResult_1 = require_ExportResult2(); + Object.defineProperty(exports, "ExportResultCode", { enumerable: true, get: function() { + return ExportResult_1.ExportResultCode; + } }); + var utils_1 = require_utils13(); + Object.defineProperty(exports, "parseKeyPairsIntoRecord", { enumerable: true, get: function() { + return utils_1.parseKeyPairsIntoRecord; + } }); + var platform_1 = require_platform11(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return platform_1.SDK_INFO; + } }); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return platform_1._globalThis; + } }); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return platform_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return platform_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return platform_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return platform_1.getStringListFromEnv; + } }); + Object.defineProperty(exports, "otperformance", { enumerable: true, get: function() { + return platform_1.otperformance; + } }); + var composite_1 = require_composite2(); + Object.defineProperty(exports, "CompositePropagator", { enumerable: true, get: function() { + return composite_1.CompositePropagator; + } }); + var W3CTraceContextPropagator_1 = require_W3CTraceContextPropagator2(); + Object.defineProperty(exports, "TRACE_PARENT_HEADER", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.TRACE_PARENT_HEADER; + } }); + Object.defineProperty(exports, "TRACE_STATE_HEADER", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.TRACE_STATE_HEADER; + } }); + Object.defineProperty(exports, "W3CTraceContextPropagator", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.W3CTraceContextPropagator; + } }); + Object.defineProperty(exports, "parseTraceParent", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.parseTraceParent; + } }); + var rpc_metadata_1 = require_rpc_metadata2(); + Object.defineProperty(exports, "RPCType", { enumerable: true, get: function() { + return rpc_metadata_1.RPCType; + } }); + Object.defineProperty(exports, "deleteRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.deleteRPCMetadata; + } }); + Object.defineProperty(exports, "getRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.getRPCMetadata; + } }); + Object.defineProperty(exports, "setRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.setRPCMetadata; + } }); + var suppress_tracing_1 = require_suppress_tracing2(); + Object.defineProperty(exports, "isTracingSuppressed", { enumerable: true, get: function() { + return suppress_tracing_1.isTracingSuppressed; + } }); + Object.defineProperty(exports, "suppressTracing", { enumerable: true, get: function() { + return suppress_tracing_1.suppressTracing; + } }); + Object.defineProperty(exports, "unsuppressTracing", { enumerable: true, get: function() { + return suppress_tracing_1.unsuppressTracing; + } }); + var TraceState_1 = require_TraceState2(); + Object.defineProperty(exports, "TraceState", { enumerable: true, get: function() { + return TraceState_1.TraceState; + } }); + var merge_1 = require_merge2(); + Object.defineProperty(exports, "merge", { enumerable: true, get: function() { + return merge_1.merge; + } }); + var timeout_1 = require_timeout2(); + Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function() { + return timeout_1.TimeoutError; + } }); + Object.defineProperty(exports, "callWithTimeout", { enumerable: true, get: function() { + return timeout_1.callWithTimeout; + } }); + var url_1 = require_url2(); + Object.defineProperty(exports, "isUrlIgnored", { enumerable: true, get: function() { + return url_1.isUrlIgnored; + } }); + Object.defineProperty(exports, "urlMatches", { enumerable: true, get: function() { + return url_1.urlMatches; + } }); + var callback_1 = require_callback2(); + Object.defineProperty(exports, "BindOnceFuture", { enumerable: true, get: function() { + return callback_1.BindOnceFuture; + } }); + var configuration_1 = require_configuration2(); + Object.defineProperty(exports, "diagLogLevelFromString", { enumerable: true, get: function() { + return configuration_1.diagLogLevelFromString; + } }); + var exporter_1 = require_exporter2(); + exports.internal = { + _export: exporter_1._export + }; +}); + // node_modules/@opentelemetry/propagator-jaeger/build/src/JaegerPropagator.js var require_JaegerPropagator = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.JaegerPropagator = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.UBER_TRACE_ID_HEADER = undefined; var api_1 = require_src(); - var core_1 = require_src3(); + var core_1 = require_src28(); exports.UBER_TRACE_ID_HEADER = "uber-trace-id"; exports.UBER_BAGGAGE_HEADER_PREFIX = "uberctx"; @@ -59408,8 +60777,14 @@ var require_JaegerPropagator = __commonJS((exports) => { for (const baggageEntry of baggageValues) { if (baggageEntry.value === undefined) continue; + let decodedValue; + try { + decodedValue = decodeURIComponent(baggageEntry.value); + } catch { + continue; + } currentBaggage = currentBaggage.setEntry(baggageEntry.key, { - value: decodeURIComponent(baggageEntry.value) + value: decodedValue }); } newContext = api_1.propagation.setBaggage(newContext, currentBaggage); @@ -59422,7 +60797,13 @@ var require_JaegerPropagator = __commonJS((exports) => { exports.JaegerPropagator = JaegerPropagator; var VALID_HEX_RE = /^[0-9a-f]{1,2}$/i; function deserializeSpanContext(serializedString) { - const headers = decodeURIComponent(serializedString).split(":"); + let decoded; + try { + decoded = decodeURIComponent(serializedString); + } catch { + return null; + } + const headers = decoded.split(":"); if (headers.length !== 4) { return null; } @@ -59435,7 +60816,7 @@ var require_JaegerPropagator = __commonJS((exports) => { }); // node_modules/@opentelemetry/propagator-jaeger/build/src/index.js -var require_src28 = __commonJS((exports) => { +var require_src29 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.UBER_TRACE_ID_HEADER = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.JaegerPropagator = undefined; var JaegerPropagator_1 = require_JaegerPropagator(); @@ -59570,7 +60951,7 @@ var require_OTLPMetricExporter = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/node/index.js -var require_node12 = __commonJS((exports) => { +var require_node13 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; var OTLPMetricExporter_1 = require_OTLPMetricExporter(); @@ -59580,20 +60961,20 @@ var require_node12 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/index.js -var require_platform11 = __commonJS((exports) => { +var require_platform12 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var node_1 = require_node12(); + var node_1 = require_node13(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return node_1.OTLPMetricExporter; } }); }); // node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/index.js -var require_src29 = __commonJS((exports) => { +var require_src30 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = exports.AggregationTemporalityPreference = exports.OTLPMetricExporter = undefined; - var platform_1 = require_platform11(); + var platform_1 = require_platform12(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return platform_1.OTLPMetricExporter; } }); @@ -59620,7 +61001,7 @@ var require_src29 = __commonJS((exports) => { var require_OTLPMetricExporter2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var exporter_metrics_otlp_http_1 = require_src29(); + var exporter_metrics_otlp_http_1 = require_src30(); var otlp_grpc_exporter_base_1 = require_src20(); var otlp_transformer_1 = require_src8(); @@ -59633,7 +61014,7 @@ var require_OTLPMetricExporter2 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/index.js -var require_src30 = __commonJS((exports) => { +var require_src31 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; var OTLPMetricExporter_1 = require_OTLPMetricExporter2(); @@ -59646,7 +61027,7 @@ var require_src30 = __commonJS((exports) => { var require_OTLPMetricExporter3 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var exporter_metrics_otlp_http_1 = require_src29(); + var exporter_metrics_otlp_http_1 = require_src30(); var otlp_transformer_1 = require_src8(); var node_http_1 = require_index_node_http(); @@ -59661,7 +61042,7 @@ var require_OTLPMetricExporter3 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/platform/node/index.js -var require_node13 = __commonJS((exports) => { +var require_node14 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; var OTLPMetricExporter_1 = require_OTLPMetricExporter3(); @@ -59671,27 +61052,27 @@ var require_node13 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/platform/index.js -var require_platform12 = __commonJS((exports) => { +var require_platform13 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var node_1 = require_node13(); + var node_1 = require_node14(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return node_1.OTLPMetricExporter; } }); }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/index.js -var require_src31 = __commonJS((exports) => { +var require_src32 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var platform_1 = require_platform12(); + var platform_1 = require_platform13(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return platform_1.OTLPMetricExporter; } }); }); // node_modules/@opentelemetry/sdk-node/build/src/utils.js -var require_utils13 = __commonJS((exports) => { +var require_utils14 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.buildSamplerFromConfig = exports.getInstanceID = exports.getMeterViewsFromConfiguration = exports.getAggregationType = exports.getInstrumentType = exports.getMeterReadersFromConfiguration = exports.getSpanLimitsFromConfiguration = exports.getSpanProcessorsFromConfiguration = exports.getSpanExporter = exports.getHttpAgentOptionsFromTls = exports.getHeadersFromConfiguration = exports.getLogRecordProcessorsFromConfiguration = exports.getLogRecordExporter = exports.getBatchLogRecordProcessorFromEnv = exports.getBatchLogRecordProcessorConfigFromEnv = exports.getLoggerProviderConfigFromEnv = exports.getPeriodicMetricReaderFromConfiguration = exports.getOtlpMetricExporterFromEnv = exports.getPeriodicExportingMetricReaderFromEnv = exports.getNonNegativeNumberFromEnv = exports.getKeyListFromObjectArray = exports.setupPropagator = exports.setupContextManager = exports.getPropagatorFromConfiguration = exports.getPropagatorFromEnv = exports.getSpanProcessorsFromEnv = exports.getOtlpProtocolFromEnv = exports.getResourceDetectorsFromConfiguration = exports.getResourceDetectorsFromEnv = exports.getResourceFromConfiguration = undefined; var api_1 = require_src(); @@ -59703,7 +61084,7 @@ var require_utils13 = __commonJS((exports) => { var resources_1 = require_src6(); var sdk_trace_base_1 = require_src12(); var propagator_b3_1 = require_src27(); - var propagator_jaeger_1 = require_src28(); + var propagator_jaeger_1 = require_src29(); var context_async_hooks_1 = require_src11(); var exporter_logs_otlp_http_1 = require_src16(); var exporter_logs_otlp_grpc_1 = require_src21(); @@ -59711,9 +61092,9 @@ var require_utils13 = __commonJS((exports) => { var otlp_exporter_base_1 = require_src4(); var otlp_grpc_exporter_base_1 = require_src20(); var sdk_metrics_1 = require_src7(); - var exporter_metrics_otlp_grpc_1 = require_src30(); - var exporter_metrics_otlp_http_1 = require_src29(); - var exporter_metrics_otlp_proto_1 = require_src31(); + var exporter_metrics_otlp_grpc_1 = require_src31(); + var exporter_metrics_otlp_http_1 = require_src30(); + var exporter_metrics_otlp_proto_1 = require_src32(); var sdk_logs_1 = require_src10(); var fs = __require("fs"); var RESOURCE_DETECTOR_ENVIRONMENT = "env"; @@ -60524,7 +61905,7 @@ var require_sdk = __commonJS((exports) => { var sdk_trace_node_1 = require_src13(); var semantic_conventions_1 = require_src2(); var core_1 = require_src3(); - var utils_1 = require_utils13(); + var utils_1 = require_utils14(); function getMetricReadersFromEnv() { const metricReaders = []; const enabledExporters = Array.from(new Set((0, core_1.getStringListFromEnv)("OTEL_METRICS_EXPORTER") ?? [])); @@ -62342,7 +63723,7 @@ var require_log = __commonJS((exports) => { }); // node_modules/yaml/dist/schema/yaml-1.1/merge.js -var require_merge2 = __commonJS((exports) => { +var require_merge3 = __commonJS((exports) => { var identity = require_identity(); var Scalar = require_Scalar(); var MERGE_KEY = "<<"; @@ -62398,7 +63779,7 @@ var require_merge2 = __commonJS((exports) => { // node_modules/yaml/dist/nodes/addPairToJSMap.js var require_addPairToJSMap = __commonJS((exports) => { var log = require_log(); - var merge = require_merge2(); + var merge = require_merge3(); var stringify = require_stringify(); var identity = require_identity(); var toJS = require_toJS(); @@ -63675,7 +65056,7 @@ var require_schema4 = __commonJS((exports) => { var bool = require_bool2(); var float = require_float3(); var int = require_int2(); - var merge = require_merge2(); + var merge = require_merge3(); var omap = require_omap(); var pairs = require_pairs(); var set = require_set(); @@ -63718,7 +65099,7 @@ var require_tags = __commonJS((exports) => { var schema = require_schema2(); var schema$1 = require_schema3(); var binary = require_binary(); - var merge = require_merge2(); + var merge = require_merge3(); var omap = require_omap(); var pairs = require_pairs(); var schema$2 = require_schema4(); @@ -67709,7 +69090,7 @@ var require_dist = __commonJS((exports) => { }); // node_modules/@opentelemetry/configuration/build/src/utils.js -var require_utils14 = __commonJS((exports) => { +var require_utils15 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.getHttpTlsConfig = exports.initializeDefaultLoggerProviderConfiguration = exports.initializeDefaultMeterProviderConfiguration = exports.initializeDefaultTracerProviderConfiguration = exports.initializeDefaultConfiguration = exports.getGrpcTlsConfig = exports.substituteEnvVars = undefined; var yaml = require_dist(); @@ -67952,7 +69333,7 @@ var require_EnvironmentConfigFactory = __commonJS((exports) => { exports.setLoggerProvider = exports.setMeterProvider = exports.setTracerProvider = exports.setSampler = exports.setPropagators = exports.setAttributeLimits = exports.setResources = exports.EnvironmentConfigFactory = undefined; var core_1 = require_src3(); var api_1 = require_src(); - var utils_1 = require_utils14(); + var utils_1 = require_utils15(); var EnvReader_1 = require_EnvReader(); var EnvDefinition_1 = require_EnvDefinition(); @@ -78168,7 +79549,7 @@ var require_FileConfigFactory = __commonJS((exports) => { var core_1 = require_src3(); var fs = __require("fs"); var yaml = require_dist(); - var utils_1 = require_utils14(); + var utils_1 = require_utils15(); var validateConfig = require_validator(); class FileConfigFactory { @@ -78341,7 +79722,7 @@ var require_ConfigFactory = __commonJS((exports) => { }); // node_modules/@opentelemetry/configuration/build/src/index.js -var require_src32 = __commonJS((exports) => { +var require_src33 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.createConfigFactory = undefined; var ConfigFactory_1 = require_ConfigFactory(); @@ -78351,7 +79732,7 @@ var require_src32 = __commonJS((exports) => { }); // node_modules/@opentelemetry/sdk-node/build/src/semconv.js -var require_semconv7 = __commonJS((exports) => { +var require_semconv8 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_SERVICE_INSTANCE_ID = exports.ATTR_PROCESS_PID = exports.ATTR_HOST_NAME = undefined; exports.ATTR_HOST_NAME = "host.name"; @@ -78418,16 +79799,16 @@ var require_diag2 = __commonJS((exports) => { var require_start = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.setupResource = exports.startNodeSDK = exports.NOOP_SDK = undefined; - var configuration_1 = require_src32(); + var configuration_1 = require_src33(); var api_1 = require_src(); - var utils_1 = require_utils13(); + var utils_1 = require_utils14(); var instrumentation_1 = require_src15(); var sdk_logs_1 = require_src10(); var sdk_metrics_1 = require_src7(); var api_logs_1 = require_src5(); var resources_1 = require_src6(); var context_async_hooks_1 = require_src11(); - var semconv_1 = require_semconv7(); + var semconv_1 = require_semconv8(); var sdk_trace_base_1 = require_src12(); var diag_1 = require_diag2(); exports.NOOP_SDK = { @@ -78551,7 +79932,7 @@ var require_start = __commonJS((exports) => { }); // node_modules/@opentelemetry/sdk-node/build/src/index.js -var require_src33 = __commonJS((exports) => { +var require_src34 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.startNodeSDK = exports.NodeSDK = exports.tracing = exports.resources = exports.node = exports.metrics = exports.logs = exports.core = exports.contextBase = exports.api = undefined; exports.api = require_src(); @@ -85284,7 +86665,7 @@ var init_client = __esm(() => { }); // node_modules/adm-zip/util/constants.js -var require_constants4 = __commonJS((exports, module) => { +var require_constants5 = __commonJS((exports, module) => { module.exports = { LOCHDR: 30, LOCSIG: 67324752, @@ -85452,10 +86833,10 @@ var require_errors2 = __commonJS((exports) => { }); // node_modules/adm-zip/util/utils.js -var require_utils15 = __commonJS((exports, module) => { +var require_utils16 = __commonJS((exports, module) => { var fsystem = __require("fs"); var pth = __require("path"); - var Constants = require_constants4(); + var Constants = require_constants5(); var Errors = require_errors2(); var isWin = typeof process === "object" && process.platform === "win32"; var is_Obj = (obj) => typeof obj === "object" && obj !== null; @@ -85544,38 +86925,42 @@ var require_utils15 = __commonJS((exports, module) => { if (exist && !overwrite) return callback(false); self2.fs.stat(path, function(err, stat2) { - if (exist && stat2.isDirectory()) { + if (exist && stat2 && stat2.isDirectory()) { return callback(false); } var folder = pth.dirname(path); self2.fs.exists(folder, function(exists) { - if (!exists) - self2.makeDir(folder); + if (!exists) { + try { + self2.makeDir(folder); + } catch (e2) { + return callback(false); + } + } + const writeToFd = function(fd) { + self2.fs.write(fd, content, 0, content.length, 0, function(writeErr) { + self2.fs.close(fd, function() { + if (writeErr) + return callback(false); + self2.fs.chmod(path, attr || 438, function() { + callback(true); + }); + }); + }); + }; self2.fs.open(path, "w", 438, function(err2, fd) { if (err2) { self2.fs.chmod(path, 438, function() { - self2.fs.open(path, "w", 438, function(err3, fd2) { - self2.fs.write(fd2, content, 0, content.length, 0, function() { - self2.fs.close(fd2, function() { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); - }); - }); + self2.fs.open(path, "w", 438, function(retryErr, fd2) { + if (retryErr || !fd2) + return callback(false); + writeToFd(fd2); }); }); } else if (fd) { - self2.fs.write(fd, content, 0, content.length, 0, function() { - self2.fs.close(fd, function() { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); - }); - }); + writeToFd(fd); } else { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); + callback(false); } }); }); @@ -85584,7 +86969,7 @@ var require_utils15 = __commonJS((exports, module) => { }; Utils.prototype.findFiles = function(path) { const self2 = this; - function findSync(dir, pattern, recursive) { + function findSync(dir, pattern, recursive, visited) { if (typeof pattern === "boolean") { recursive = pattern; pattern = undefined; @@ -85596,44 +86981,75 @@ var require_utils15 = __commonJS((exports, module) => { if (!pattern || pattern.test(path2)) { files2.push(pth.normalize(path2) + (stat2.isDirectory() ? self2.sep : "")); } - if (stat2.isDirectory() && recursive) - files2 = files2.concat(findSync(path2, pattern, recursive)); + if (stat2.isDirectory() && recursive) { + const realDir = self2.fs.realpathSync(path2); + if (!visited.has(realDir)) { + visited.add(realDir); + files2 = files2.concat(findSync(path2, pattern, recursive, visited)); + } + } }); return files2; } - return findSync(path, undefined, true); + return findSync(path, undefined, true, new Set([self2.fs.realpathSync(path)])); }; Utils.prototype.findFilesAsync = function(dir, cb) { const self2 = this; - let results = []; - self2.fs.readdir(dir, function(err, list) { - if (err) - return cb(err); - let list_length = list.length; - if (!list_length) - return cb(null, results); - list.forEach(function(file) { - file = pth.join(dir, file); - self2.fs.stat(file, function(err2, stat2) { - if (err2) - return cb(err2); - if (stat2) { + const results = []; + let finished = false; + const finish = function(err) { + if (finished) + return; + finished = true; + cb(err, err ? undefined : results); + }; + const walk = function(dir2, visited, done) { + self2.fs.readdir(dir2, function(err, list) { + if (err) + return done(err); + let pending = list.length; + if (!pending) + return done(); + list.forEach(function(name) { + const file = pth.join(dir2, name); + self2.fs.stat(file, function(err2, stat2) { + if (err2) + return done(err2); + if (!stat2) { + if (!--pending) + done(); + return; + } results.push(pth.normalize(file) + (stat2.isDirectory() ? self2.sep : "")); - if (stat2.isDirectory()) { - self2.findFilesAsync(file, function(err3, res) { - if (err3) - return cb(err3); - results = results.concat(res); - if (!--list_length) - cb(null, results); - }); - } else { - if (!--list_length) - cb(null, results); + if (!stat2.isDirectory()) { + if (!--pending) + done(); + return; } - } + self2.fs.realpath(file, function(err3, realDir) { + if (err3) + return done(err3); + if (visited.has(realDir)) { + if (!--pending) + done(); + return; + } + visited.add(realDir); + walk(file, visited, function(err4) { + if (err4) + return done(err4); + if (!--pending) + done(); + }); + }); + }); }); }); + }; + self2.fs.realpath(dir, function(err, realDir) { + if (err) + return finish(err); + walk(dir, new Set([realDir]), finish); }); }; Utils.prototype.getAttributes = function() {}; @@ -85807,8 +87223,8 @@ var require_decoder2 = __commonJS((exports, module) => { // node_modules/adm-zip/util/index.js var require_util6 = __commonJS((exports, module) => { - module.exports = require_utils15(); - module.exports.Constants = require_constants4(); + module.exports = require_utils16(); + module.exports.Constants = require_constants5(); module.exports.Errors = require_errors2(); module.exports.FileAttr = require_fattr(); module.exports.decoder = require_decoder2(); @@ -86418,35 +87834,8 @@ var require_zipEntry = __commonJS((exports, module) => { return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize); } function crc32OK(data) { - if (!_centralHeader.flags_desc && !_centralHeader.localHeader.flags_desc) { - if (Utils.crc32(data) !== _centralHeader.localHeader.crc) { - return false; - } - } else { - const descriptor = {}; - const dataEndOffset = _centralHeader.realDataOffset + _centralHeader.compressedSize; - if (input.readUInt32LE(dataEndOffset) == Constants.LOCSIG || input.readUInt32LE(dataEndOffset) == Constants.CENSIG) { - throw Utils.Errors.DESCRIPTOR_NOT_EXIST(); - } - if (input.readUInt32LE(dataEndOffset) == Constants.EXTSIG) { - descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC); - descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ); - descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN); - } else if (input.readUInt16LE(dataEndOffset + 12) === 19280) { - descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC - 4); - descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ - 4); - descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN - 4); - } else { - throw Utils.Errors.DESCRIPTOR_UNKNOWN(); - } - if (descriptor.compressedSize !== _centralHeader.compressedSize || descriptor.size !== _centralHeader.size || descriptor.crc !== _centralHeader.crc) { - throw Utils.Errors.DESCRIPTOR_FAULTY(); - } - if (Utils.crc32(data) !== descriptor.crc) { - return false; - } - } - return true; + const expectedCrc = _centralHeader.flags_desc || _centralHeader.localHeader.flags_desc ? _centralHeader.crc : _centralHeader.localHeader.crc; + return Utils.crc32(data) === expectedCrc; } function decompress(async, callback, pass) { if (typeof callback === "undefined" && typeof async === "string") { @@ -86471,9 +87860,10 @@ var require_zipEntry = __commonJS((exports, module) => { } compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass); } - var data = Buffer.alloc(_centralHeader.size); + var data; switch (_centralHeader.method) { case Utils.Constants.STORED: + data = Buffer.alloc(compressedData.length); compressedData.copy(data); if (!crc32OK(data)) { if (async && callback) @@ -86487,15 +87877,13 @@ var require_zipEntry = __commonJS((exports, module) => { case Utils.Constants.DEFLATED: var inflater = new Methods.Inflater(compressedData, _centralHeader.size); if (!async) { - const result = inflater.inflate(data); - result.copy(data, 0); + data = inflater.inflate(); if (!crc32OK(data)) { throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`); } return data; } else { inflater.inflateAsync(function(result) { - result.copy(result, 0); if (callback) { if (!crc32OK(result)) { callback(result, Utils.Errors.BAD_CRC()); @@ -86639,8 +88027,8 @@ var require_zipEntry = __commonJS((exports, module) => { throw Utils.Errors.COMMENT_TOO_LONG(); }, get name() { - var n = decoder.decode(_entryName); - return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); + const n = decoder.decode(_entryName); + return _isDirectory ? n.replace(/[/\\]$/, "").split("/").pop() : n.split("/").pop(); }, get isDirectory() { return _isDirectory; @@ -86741,7 +88129,7 @@ var require_zipFile = __commonJS((exports, module) => { var Headers3 = require_headers(); var Utils = require_util6(); module.exports = function(inBuffer, options) { - var entryList = [], entryTable = {}, _comment = Buffer.alloc(0), mainHeader = new Headers3.MainHeader, loadedEntries = false; + var entryList = [], entryTable = Object.create(null), _comment = Buffer.alloc(0), mainHeader = new Headers3.MainHeader, loadedEntries = false; var password = null; const temporary = new Set; const opts = options; @@ -86777,7 +88165,7 @@ var require_zipFile = __commonJS((exports, module) => { } function readEntries() { loadedEntries = true; - entryTable = {}; + entryTable = Object.create(null); if (mainHeader.diskEntries > (inBuffer.length - mainHeader.offset) / Utils.Constants.CENHDR) { throw Utils.Errors.DISK_ENTRY_TOO_LARGE(); } @@ -86835,7 +88223,7 @@ var require_zipFile = __commonJS((exports, module) => { } function sortEntries() { if (entryList.length > 1 && !noSort) { - entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); + entryList = entryList.map((entry) => ({ entry, key: entry.entryName.toLowerCase() })).sort((a, b) => a.key.localeCompare(b.key)).map((pair) => pair.entry); } } return { @@ -87071,6 +88459,9 @@ var require_adm_zip = __commonJS((exports, module) => { } Object.assign(opts, options); const filetools = new Utils(opts); + const applyDirAttributes = (dirEntries) => { + dirEntries.filter((d) => d.attr).sort((a, b) => b.path.length - a.path.length).forEach((d) => filetools.fs.chmodSync(d.path, d.attr)); + }; if (typeof opts.decoder !== "object" || typeof opts.decoder.encode !== "function" || typeof opts.decoder.decode !== "function") { opts.decoder = Utils.decoder; } @@ -87435,8 +88826,8 @@ var require_adm_zip = __commonJS((exports, module) => { if (!content2) { throw Utils.Errors.CANT_EXTRACT_FILE(); } - var name = canonical(child.entryName); - var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name)); + var name = canonical(maintainEntryPath ? child.entryName : child.entryName.substring(item.entryName.length)); + var childName = sanitize(targetPath, name); const fileAttr2 = keepOriginalPermission ? child.header.fileAttr : undefined; filetools.writeFileTo(childName, content2, overwrite, fileAttr2); }); @@ -87461,7 +88852,7 @@ var require_adm_zip = __commonJS((exports, module) => { if (entry.isDirectory) { continue; } - var content = _zip.entries[entry].getData(pass); + var content = entry.getData(pass); if (!content) { return false; } @@ -87477,10 +88868,13 @@ var require_adm_zip = __commonJS((exports, module) => { overwrite = get_Bool(false, overwrite); if (!_zip) throw Utils.Errors.NO_ZIP(); + const dirEntries = []; _zip.entries.forEach(function(entry) { var entryName = sanitize(targetPath, canonical(entry.entryName)); if (entry.isDirectory) { filetools.makeDir(entryName); + if (keepOriginalPermission) + dirEntries.push({ path: entryName, attr: entry.header.fileAttr }); return; } var content = entry.getData(pass); @@ -87491,10 +88885,9 @@ var require_adm_zip = __commonJS((exports, module) => { filetools.writeFileTo(entryName, content, overwrite, fileAttr); try { filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time); - } catch (err) { - throw Utils.Errors.CANT_EXTRACT_FILE(); - } + } catch (err) {} }); + applyDirAttributes(dirEntries); }, extractAllToAsync: function(targetPath, overwrite, keepOriginalPermission, callback) { callback = get_Fun(overwrite, keepOriginalPermission, callback); @@ -87527,18 +88920,32 @@ var require_adm_zip = __commonJS((exports, module) => { fileEntries.push(e2); } }); + const deferredDirAttr = []; for (const entry of dirEntries) { const dirPath = getPath(entry); const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; try { filetools.makeDir(dirPath); - if (dirAttr) - filetools.fs.chmodSync(dirPath, dirAttr); - filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); } catch (er) { callback(getError("Unable to create folder", dirPath)); + continue; } + if (dirAttr) + deferredDirAttr.push({ path: dirPath, attr: dirAttr }); + try { + filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); + } catch (er) {} } + const done = (err) => { + if (!err) { + try { + applyDirAttributes(deferredDirAttr); + } catch (er) { + return callback(getError("Unable to set folder permissions", er.path || "")); + } + } + callback(err); + }; fileEntries.reverse().reduce(function(next, entry) { return function(err) { if (err) { @@ -87555,21 +88962,17 @@ var require_adm_zip = __commonJS((exports, module) => { const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function(succ) { if (!succ) { - next(getError("Unable to write file", filePath)); + return next(getError("Unable to write file", filePath)); } - filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function(err_2) { - if (err_2) { - next(getError("Unable to set times", filePath)); - } else { - next(); - } + filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function() { + next(); }); }); } }); } }; - }, callback)(); + }, done)(); }, writeZip: function(targetFileName, callback) { if (arguments.length === 1) { @@ -98394,7 +99797,7 @@ var init_bin = __esm(() => { }); // src/provisioning/default.ts -var CLI_VERSION = "1.0.0-beta.9"; +var CLI_VERSION = "1.0.0-beta.10"; // src/provisioning/index.ts var exports_provisioning = {}; @@ -99421,7 +100824,7 @@ var opentelemetry2 = __toESM(require_src(), 1); // src/telemetry/init.ts var import_core = __toESM(require_src3(), 1); var import_exporter_trace_otlp_proto = __toESM(require_src9(), 1); -var import_sdk_node = __toESM(require_src33(), 1); +var import_sdk_node = __toESM(require_src34(), 1); var import_sdk_trace_base2 = __toESM(require_src12(), 1); // src/telemetry/live_processor.ts @@ -99590,6 +100993,9 @@ __export(exports_client_gen, { RegistryProtocolNameToValue: () => RegistryProtocolNameToValue, RegistryProtocol: () => RegistryProtocol, Port: () => Port, + PatchConflictValueToName: () => PatchConflictValueToName, + PatchConflictNameToValue: () => PatchConflictNameToValue, + PatchConflict: () => PatchConflict, ObjectTypeDef: () => ObjectTypeDef, NetworkProtocolValueToName: () => NetworkProtocolValueToName, NetworkProtocolNameToValue: () => NetworkProtocolNameToValue, @@ -99606,6 +101012,7 @@ __export(exports_client_gen, { ListTypeDef: () => ListTypeDef, Label: () => Label, LLMTokenUsage: () => LLMTokenUsage, + LLMSkill: () => LLMSkill, LLMMessageRoleValueToName: () => LLMMessageRoleValueToName, LLMMessageRoleNameToValue: () => LLMMessageRoleNameToValue, LLMMessageRole: () => LLMMessageRole, @@ -99629,6 +101036,7 @@ __export(exports_client_gen, { HTTPState: () => HTTPState, GitRepository: () => GitRepository, GitRef: () => GitRef, + GitCommit: () => GitCommit, GeneratorGroup: () => GeneratorGroup, Generator: () => Generator, GeneratedCode: () => GeneratedCode, @@ -99651,7 +101059,6 @@ __export(exports_client_gen, { Error: () => Error2, EnvVariable: () => EnvVariable, EnvFile: () => EnvFile, - Env: () => Env, EnumValueTypeDef: () => EnumValueTypeDef, EnumTypeDef: () => EnumTypeDef, EngineCacheEntrySet: () => EngineCacheEntrySet, @@ -99684,8 +101091,9 @@ __export(exports_client_gen, { CacheSharingModeValueToName: () => CacheSharingModeValueToName, CacheSharingModeNameToValue: () => CacheSharingModeNameToValue, CacheSharingMode: () => CacheSharingMode, - Binding: () => Binding, BaseClient: () => BaseClient, + AgentGroup: () => AgentGroup, + Agent: () => Agent, Address: () => Address }); @@ -100318,6 +101726,31 @@ function NetworkProtocolNameToValue(name) { return name; } } +var PatchConflict; +((PatchConflict2) => { + PatchConflict2["Fail"] = "FAIL"; + PatchConflict2["LeaveConflictMarkers"] = "LEAVE_CONFLICT_MARKERS"; +})(PatchConflict ||= {}); +function PatchConflictValueToName(value) { + switch (value) { + case "FAIL" /* Fail */: + return "FAIL"; + case "LEAVE_CONFLICT_MARKERS" /* LeaveConflictMarkers */: + return "LEAVE_CONFLICT_MARKERS"; + default: + return value; + } +} +function PatchConflictNameToValue(name) { + switch (name) { + case "FAIL": + return "FAIL" /* Fail */; + case "LEAVE_CONFLICT_MARKERS": + return "LEAVE_CONFLICT_MARKERS" /* LeaveConflictMarkers */; + default: + return name; + } +} var RegistryProtocol; ((RegistryProtocol2) => { RegistryProtocol2["Http"] = "HTTP"; @@ -100517,21 +101950,15 @@ class Address extends BaseClient { }; } -class Binding extends BaseClient { +class Agent extends BaseClient { _id = undefined; - _asString = undefined; - _digest = undefined; - _isNull = undefined; + _description = undefined; _name = undefined; - _typeName = undefined; - constructor(ctx, _id, _asString, _digest, _isNull, _name, _typeName) { + constructor(ctx, _id, _description, _name) { super(ctx); this._id = _id; - this._asString = _asString; - this._digest = _digest; - this._isNull = _isNull; + this._description = _description; this._name = _name; - this._typeName = _typeName; } id = async () => { if (this._id) { @@ -100541,217 +101968,55 @@ class Binding extends BaseClient { const response = await ctx.execute(); return response; }; - asAddress = () => { - const ctx = this._ctx.select("asAddress"); - return new Address(ctx); - }; - asCacheVolume = () => { - const ctx = this._ctx.select("asCacheVolume"); - return new CacheVolume(ctx); - }; - asChangeset = () => { - const ctx = this._ctx.select("asChangeset"); - return new Changeset(ctx); - }; - asCheck = () => { - const ctx = this._ctx.select("asCheck"); - return new Check(ctx); - }; - asCheckGroup = () => { - const ctx = this._ctx.select("asCheckGroup"); - return new CheckGroup(ctx); - }; - asCloud = () => { - const ctx = this._ctx.select("asCloud"); - return new Cloud(ctx); - }; - asContainer = () => { - const ctx = this._ctx.select("asContainer"); - return new Container(ctx); - }; - asCurrentModuleAsSDK = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDK"); - return new CurrentModuleAsSDK(ctx); - }; - asCurrentModuleAsSDKClient = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDKClient"); - return new CurrentModuleAsSDKClient(ctx); - }; - asCurrentModuleAsSDKModule = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDKModule"); - return new CurrentModuleAsSDKModule(ctx); - }; - asDiffStat = () => { - const ctx = this._ctx.select("asDiffStat"); - return new DiffStat(ctx); - }; - asDirectory = () => { - const ctx = this._ctx.select("asDirectory"); - return new Directory(ctx); - }; - asEnv = () => { - const ctx = this._ctx.select("asEnv"); - return new Env(ctx); - }; - asEnvFile = () => { - const ctx = this._ctx.select("asEnvFile"); - return new EnvFile(ctx); - }; - asFile = () => { - const ctx = this._ctx.select("asFile"); - return new File(ctx); - }; - asGenerator = () => { - const ctx = this._ctx.select("asGenerator"); - return new Generator(ctx); - }; - asGeneratorGroup = () => { - const ctx = this._ctx.select("asGeneratorGroup"); - return new GeneratorGroup(ctx); - }; - asGitRef = () => { - const ctx = this._ctx.select("asGitRef"); - return new GitRef(ctx); - }; - asGitRepository = () => { - const ctx = this._ctx.select("asGitRepository"); - return new GitRepository(ctx); - }; - asHTTPState = () => { - const ctx = this._ctx.select("asHTTPState"); - return new HTTPState(ctx); - }; - asJSONValue = () => { - const ctx = this._ctx.select("asJSONValue"); - return new JSONValue(ctx); - }; - asLLMContentBlock = () => { - const ctx = this._ctx.select("asLLMContentBlock"); - return new LLMContentBlock(ctx); - }; - asLLMMessage = () => { - const ctx = this._ctx.select("asLLMMessage"); - return new LLMMessage(ctx); - }; - asModule = () => { - const ctx = this._ctx.select("asModule"); - return new Module_(ctx); - }; - asModuleConfigClient = () => { - const ctx = this._ctx.select("asModuleConfigClient"); - return new ModuleConfigClient(ctx); - }; - asModuleSource = () => { - const ctx = this._ctx.select("asModuleSource"); - return new ModuleSource(ctx); - }; - asSchema = () => { - const ctx = this._ctx.select("asSchema"); - return new Schema(ctx); - }; - asSearchResult = () => { - const ctx = this._ctx.select("asSearchResult"); - return new SearchResult(ctx); - }; - asSearchSubmatch = () => { - const ctx = this._ctx.select("asSearchSubmatch"); - return new SearchSubmatch(ctx); - }; - asSecret = () => { - const ctx = this._ctx.select("asSecret"); - return new Secret(ctx); - }; - asService = () => { - const ctx = this._ctx.select("asService"); - return new Service(ctx); - }; - asSocket = () => { - const ctx = this._ctx.select("asSocket"); - return new Socket(ctx); - }; - asStat = () => { - const ctx = this._ctx.select("asStat"); - return new Stat(ctx); - }; - asString = async () => { - if (this._asString) { - return this._asString; + description = async () => { + if (this._description) { + return this._description; } - const ctx = this._ctx.select("asString"); + const ctx = this._ctx.select("description"); const response = await ctx.execute(); return response; }; - asUp = () => { - const ctx = this._ctx.select("asUp"); - return new Up(ctx); - }; - asUpGroup = () => { - const ctx = this._ctx.select("asUpGroup"); - return new UpGroup(ctx); - }; - asVolume = () => { - const ctx = this._ctx.select("asVolume"); - return new Volume(ctx); - }; - asWorkspace = () => { - const ctx = this._ctx.select("asWorkspace"); - return new Workspace(ctx); - }; - asWorkspaceGit = () => { - const ctx = this._ctx.select("asWorkspaceGit"); - return new WorkspaceGit(ctx); - }; - asWorkspaceMigration = () => { - const ctx = this._ctx.select("asWorkspaceMigration"); - return new WorkspaceMigration(ctx); - }; - asWorkspaceMigrationStep = () => { - const ctx = this._ctx.select("asWorkspaceMigrationStep"); - return new WorkspaceMigrationStep(ctx); - }; - asWorkspaceModule = () => { - const ctx = this._ctx.select("asWorkspaceModule"); - return new WorkspaceModule(ctx); - }; - asWorkspaceModuleSetting = () => { - const ctx = this._ctx.select("asWorkspaceModuleSetting"); - return new WorkspaceModuleSetting(ctx); - }; - asWorkspaceSDK = () => { - const ctx = this._ctx.select("asWorkspaceSDK"); - return new WorkspaceSDK(ctx); - }; - digest = async () => { - if (this._digest) { - return this._digest; + name = async () => { + if (this._name) { + return this._name; } - const ctx = this._ctx.select("digest"); + const ctx = this._ctx.select("name"); const response = await ctx.execute(); return response; }; - isNull = async () => { - if (this._isNull) { - return this._isNull; - } - const ctx = this._ctx.select("isNull"); + originalModule = () => { + const ctx = this._ctx.select("originalModule"); + return new Module_(ctx); + }; + path = async () => { + const ctx = this._ctx.select("path"); const response = await ctx.execute(); return response; }; - name = async () => { - if (this._name) { - return this._name; +} + +class AgentGroup extends BaseClient { + _id = undefined; + constructor(ctx, _id) { + super(ctx); + this._id = _id; + } + id = async () => { + if (this._id) { + return this._id; } - const ctx = this._ctx.select("name"); + const ctx = this._ctx.select("id"); const response = await ctx.execute(); return response; }; - typeName = async () => { - if (this._typeName) { - return this._typeName; - } - const ctx = this._ctx.select("typeName"); + compose = (opts) => { + const ctx = this._ctx.select("compose", { ...opts }); + return new LLM(ctx); + }; + list = async () => { + const ctx = this._ctx.select("list").select("id"); const response = await ctx.execute(); - return response; + return response.map((r) => new Agent(ctx.copy().selectNode(r.id, "Agent"))); }; } @@ -100917,9 +102182,13 @@ class Check extends BaseClient { const response = await ctx.execute(); return response; }; - error = () => { - const ctx = this._ctx.select("error"); - return new Error2(ctx); + error = async () => { + const ctx = this._ctx.select("error").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Error2(ctx.copy().selectNode(response, "Error")); }; name = async () => { if (this._name) { @@ -101112,9 +102381,13 @@ class Container extends BaseClient { const ctx = this._ctx.select("directory", { path, ...opts }); return new Directory(ctx); }; - dockerHealthcheck = () => { - const ctx = this._ctx.select("dockerHealthcheck"); - return new HealthcheckConfig(ctx); + dockerHealthcheck = async () => { + const ctx = this._ctx.select("dockerHealthcheck").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new HealthcheckConfig(ctx.copy().selectNode(response, "HealthcheckConfig")); }; entrypoint = async () => { const ctx = this._ctx.select("entrypoint"); @@ -101271,9 +102544,13 @@ class Container extends BaseClient { const ctx = this._ctx.select("rootfs"); return new Directory(ctx); }; - stat = (path, opts) => { - const ctx = this._ctx.select("stat", { path, ...opts }); - return new Stat(ctx); + stat = async (path, opts) => { + const ctx = this._ctx.select("stat", { path, ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; stderr = async () => { if (this._stderr) { @@ -101544,8 +102821,8 @@ class CurrentModule extends BaseClient { const response = await ctx.execute(); return response; }; - asSDK = (opts) => { - const ctx = this._ctx.select("asSDK", { ...opts }); + asSDK = (workspace) => { + const ctx = this._ctx.select("asSDK", { workspace }); return new CurrentModuleAsSDK(ctx); }; dependencies = async () => { @@ -101889,9 +103166,13 @@ class Directory extends BaseClient { const response = await ctx.execute(); return response.map((r) => new SearchResult(ctx.copy().selectNode(r.id, "SearchResult"))); }; - stat = (path, opts) => { - const ctx = this._ctx.select("stat", { path, ...opts }); - return new Stat(ctx); + stat = async (path, opts) => { + const ctx = this._ctx.select("stat", { path, ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -101930,12 +103211,18 @@ class Directory extends BaseClient { const ctx = this._ctx.select("withNewFile", { path, contents, ...opts }); return new Directory(ctx); }; - withPatch = (patch) => { - const ctx = this._ctx.select("withPatch", { patch }); + withPatch = (patch, opts) => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName } + }; + const ctx = this._ctx.select("withPatch", { patch, ...opts, __metadata: metadata }); return new Directory(ctx); }; - withPatchFile = (patch) => { - const ctx = this._ctx.select("withPatchFile", { patch }); + withPatchFile = (patch, opts) => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName } + }; + const ctx = this._ctx.select("withPatchFile", { patch, ...opts, __metadata: metadata }); return new Directory(ctx); }; withSymlink = (target, linkName) => { @@ -102240,9 +103527,13 @@ class EnumTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -102305,9 +103596,13 @@ class EnumValueTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; value = async () => { if (this._value) { @@ -102319,435 +103614,6 @@ class EnumValueTypeDef extends BaseClient { }; } -class Env extends BaseClient { - _id = undefined; - constructor(ctx, _id) { - super(ctx); - this._id = _id; - } - id = async () => { - if (this._id) { - return this._id; - } - const ctx = this._ctx.select("id"); - const response = await ctx.execute(); - return response; - }; - check = (name) => { - const ctx = this._ctx.select("check", { name }); - return new Check(ctx); - }; - checks = (opts) => { - const ctx = this._ctx.select("checks", { ...opts }); - return new CheckGroup(ctx); - }; - input = (name) => { - const ctx = this._ctx.select("input", { name }); - return new Binding(ctx); - }; - inputs = async () => { - const ctx = this._ctx.select("inputs").select("id"); - const response = await ctx.execute(); - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))); - }; - output = (name) => { - const ctx = this._ctx.select("output", { name }); - return new Binding(ctx); - }; - outputs = async () => { - const ctx = this._ctx.select("outputs").select("id"); - const response = await ctx.execute(); - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))); - }; - services = (opts) => { - const ctx = this._ctx.select("services", { ...opts }); - return new UpGroup(ctx); - }; - withAddressInput = (name, value, description) => { - const ctx = this._ctx.select("withAddressInput", { name, value, description }); - return new Env(ctx); - }; - withAddressOutput = (name, description) => { - const ctx = this._ctx.select("withAddressOutput", { name, description }); - return new Env(ctx); - }; - withCacheVolumeInput = (name, value, description) => { - const ctx = this._ctx.select("withCacheVolumeInput", { name, value, description }); - return new Env(ctx); - }; - withCacheVolumeOutput = (name, description) => { - const ctx = this._ctx.select("withCacheVolumeOutput", { name, description }); - return new Env(ctx); - }; - withChangesetInput = (name, value, description) => { - const ctx = this._ctx.select("withChangesetInput", { name, value, description }); - return new Env(ctx); - }; - withChangesetOutput = (name, description) => { - const ctx = this._ctx.select("withChangesetOutput", { name, description }); - return new Env(ctx); - }; - withCheckGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withCheckGroupInput", { name, value, description }); - return new Env(ctx); - }; - withCheckGroupOutput = (name, description) => { - const ctx = this._ctx.select("withCheckGroupOutput", { name, description }); - return new Env(ctx); - }; - withCheckInput = (name, value, description) => { - const ctx = this._ctx.select("withCheckInput", { name, value, description }); - return new Env(ctx); - }; - withCheckOutput = (name, description) => { - const ctx = this._ctx.select("withCheckOutput", { name, description }); - return new Env(ctx); - }; - withCloudInput = (name, value, description) => { - const ctx = this._ctx.select("withCloudInput", { name, value, description }); - return new Env(ctx); - }; - withCloudOutput = (name, description) => { - const ctx = this._ctx.select("withCloudOutput", { name, description }); - return new Env(ctx); - }; - withContainerInput = (name, value, description) => { - const ctx = this._ctx.select("withContainerInput", { name, value, description }); - return new Env(ctx); - }; - withContainerOutput = (name, description) => { - const ctx = this._ctx.select("withContainerOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModule = () => { - const ctx = this._ctx.select("withCurrentModule"); - return new Env(ctx); - }; - withCurrentModuleAsSDKClientInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKClientInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKClientOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKClientOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKModuleInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKModuleOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKModuleOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKOutput", { name, description }); - return new Env(ctx); - }; - withDiffStatInput = (name, value, description) => { - const ctx = this._ctx.select("withDiffStatInput", { name, value, description }); - return new Env(ctx); - }; - withDiffStatOutput = (name, description) => { - const ctx = this._ctx.select("withDiffStatOutput", { name, description }); - return new Env(ctx); - }; - withDirectoryInput = (name, value, description) => { - const ctx = this._ctx.select("withDirectoryInput", { name, value, description }); - return new Env(ctx); - }; - withDirectoryOutput = (name, description) => { - const ctx = this._ctx.select("withDirectoryOutput", { name, description }); - return new Env(ctx); - }; - withEnvFileInput = (name, value, description) => { - const ctx = this._ctx.select("withEnvFileInput", { name, value, description }); - return new Env(ctx); - }; - withEnvFileOutput = (name, description) => { - const ctx = this._ctx.select("withEnvFileOutput", { name, description }); - return new Env(ctx); - }; - withEnvInput = (name, value, description) => { - const ctx = this._ctx.select("withEnvInput", { name, value, description }); - return new Env(ctx); - }; - withEnvOutput = (name, description) => { - const ctx = this._ctx.select("withEnvOutput", { name, description }); - return new Env(ctx); - }; - withFileInput = (name, value, description) => { - const ctx = this._ctx.select("withFileInput", { name, value, description }); - return new Env(ctx); - }; - withFileOutput = (name, description) => { - const ctx = this._ctx.select("withFileOutput", { name, description }); - return new Env(ctx); - }; - withGeneratorGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withGeneratorGroupInput", { name, value, description }); - return new Env(ctx); - }; - withGeneratorGroupOutput = (name, description) => { - const ctx = this._ctx.select("withGeneratorGroupOutput", { name, description }); - return new Env(ctx); - }; - withGeneratorInput = (name, value, description) => { - const ctx = this._ctx.select("withGeneratorInput", { name, value, description }); - return new Env(ctx); - }; - withGeneratorOutput = (name, description) => { - const ctx = this._ctx.select("withGeneratorOutput", { name, description }); - return new Env(ctx); - }; - withGitRefInput = (name, value, description) => { - const ctx = this._ctx.select("withGitRefInput", { name, value, description }); - return new Env(ctx); - }; - withGitRefOutput = (name, description) => { - const ctx = this._ctx.select("withGitRefOutput", { name, description }); - return new Env(ctx); - }; - withGitRepositoryInput = (name, value, description) => { - const ctx = this._ctx.select("withGitRepositoryInput", { name, value, description }); - return new Env(ctx); - }; - withGitRepositoryOutput = (name, description) => { - const ctx = this._ctx.select("withGitRepositoryOutput", { name, description }); - return new Env(ctx); - }; - withHTTPStateInput = (name, value, description) => { - const ctx = this._ctx.select("withHTTPStateInput", { name, value, description }); - return new Env(ctx); - }; - withHTTPStateOutput = (name, description) => { - const ctx = this._ctx.select("withHTTPStateOutput", { name, description }); - return new Env(ctx); - }; - withJSONValueInput = (name, value, description) => { - const ctx = this._ctx.select("withJSONValueInput", { name, value, description }); - return new Env(ctx); - }; - withJSONValueOutput = (name, description) => { - const ctx = this._ctx.select("withJSONValueOutput", { name, description }); - return new Env(ctx); - }; - withLLMContentBlockInput = (name, value, description) => { - const ctx = this._ctx.select("withLLMContentBlockInput", { name, value, description }); - return new Env(ctx); - }; - withLLMContentBlockOutput = (name, description) => { - const ctx = this._ctx.select("withLLMContentBlockOutput", { name, description }); - return new Env(ctx); - }; - withLLMMessageInput = (name, value, description) => { - const ctx = this._ctx.select("withLLMMessageInput", { name, value, description }); - return new Env(ctx); - }; - withLLMMessageOutput = (name, description) => { - const ctx = this._ctx.select("withLLMMessageOutput", { name, description }); - return new Env(ctx); - }; - withMainModule = (module_) => { - const ctx = this._ctx.select("withMainModule", { - module: module_ - }); - return new Env(ctx); - }; - withModule = (module_) => { - const ctx = this._ctx.select("withModule", { - module: module_ - }); - return new Env(ctx); - }; - withModuleConfigClientInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleConfigClientInput", { name, value, description }); - return new Env(ctx); - }; - withModuleConfigClientOutput = (name, description) => { - const ctx = this._ctx.select("withModuleConfigClientOutput", { name, description }); - return new Env(ctx); - }; - withModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleInput", { name, value, description }); - return new Env(ctx); - }; - withModuleOutput = (name, description) => { - const ctx = this._ctx.select("withModuleOutput", { name, description }); - return new Env(ctx); - }; - withModuleSourceInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleSourceInput", { name, value, description }); - return new Env(ctx); - }; - withModuleSourceOutput = (name, description) => { - const ctx = this._ctx.select("withModuleSourceOutput", { name, description }); - return new Env(ctx); - }; - withSchemaInput = (name, value, description) => { - const ctx = this._ctx.select("withSchemaInput", { name, value, description }); - return new Env(ctx); - }; - withSchemaOutput = (name, description) => { - const ctx = this._ctx.select("withSchemaOutput", { name, description }); - return new Env(ctx); - }; - withSearchResultInput = (name, value, description) => { - const ctx = this._ctx.select("withSearchResultInput", { name, value, description }); - return new Env(ctx); - }; - withSearchResultOutput = (name, description) => { - const ctx = this._ctx.select("withSearchResultOutput", { name, description }); - return new Env(ctx); - }; - withSearchSubmatchInput = (name, value, description) => { - const ctx = this._ctx.select("withSearchSubmatchInput", { name, value, description }); - return new Env(ctx); - }; - withSearchSubmatchOutput = (name, description) => { - const ctx = this._ctx.select("withSearchSubmatchOutput", { name, description }); - return new Env(ctx); - }; - withSecretInput = (name, value, description) => { - const ctx = this._ctx.select("withSecretInput", { name, value, description }); - return new Env(ctx); - }; - withSecretOutput = (name, description) => { - const ctx = this._ctx.select("withSecretOutput", { name, description }); - return new Env(ctx); - }; - withServiceInput = (name, value, description) => { - const ctx = this._ctx.select("withServiceInput", { name, value, description }); - return new Env(ctx); - }; - withServiceOutput = (name, description) => { - const ctx = this._ctx.select("withServiceOutput", { name, description }); - return new Env(ctx); - }; - withSocketInput = (name, value, description) => { - const ctx = this._ctx.select("withSocketInput", { name, value, description }); - return new Env(ctx); - }; - withSocketOutput = (name, description) => { - const ctx = this._ctx.select("withSocketOutput", { name, description }); - return new Env(ctx); - }; - withStatInput = (name, value, description) => { - const ctx = this._ctx.select("withStatInput", { name, value, description }); - return new Env(ctx); - }; - withStatOutput = (name, description) => { - const ctx = this._ctx.select("withStatOutput", { name, description }); - return new Env(ctx); - }; - withStringInput = (name, value, description) => { - const ctx = this._ctx.select("withStringInput", { name, value, description }); - return new Env(ctx); - }; - withStringOutput = (name, description) => { - const ctx = this._ctx.select("withStringOutput", { name, description }); - return new Env(ctx); - }; - withUpGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withUpGroupInput", { name, value, description }); - return new Env(ctx); - }; - withUpGroupOutput = (name, description) => { - const ctx = this._ctx.select("withUpGroupOutput", { name, description }); - return new Env(ctx); - }; - withUpInput = (name, value, description) => { - const ctx = this._ctx.select("withUpInput", { name, value, description }); - return new Env(ctx); - }; - withUpOutput = (name, description) => { - const ctx = this._ctx.select("withUpOutput", { name, description }); - return new Env(ctx); - }; - withVolumeInput = (name, value, description) => { - const ctx = this._ctx.select("withVolumeInput", { name, value, description }); - return new Env(ctx); - }; - withVolumeOutput = (name, description) => { - const ctx = this._ctx.select("withVolumeOutput", { name, description }); - return new Env(ctx); - }; - withWorkspace = (workspace) => { - const ctx = this._ctx.select("withWorkspace", { workspace }); - return new Env(ctx); - }; - withWorkspaceGitInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceGitInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceGitOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceGitOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceMigrationStepInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationStepInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationStepOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationStepOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceModuleInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceModuleOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceModuleOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceModuleSettingInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceModuleSettingInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceModuleSettingOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceModuleSettingOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceSDKInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceSDKInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceSDKOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceSDKOutput", { name, description }); - return new Env(ctx); - }; - withoutOutputs = () => { - const ctx = this._ctx.select("withoutOutputs"); - return new Env(ctx); - }; - workspace = () => { - const ctx = this._ctx.select("workspace"); - return new Directory(ctx); - }; - with = (arg) => { - return arg(this); - }; -} - class EnvFile extends BaseClient { _id = undefined; _exists = undefined; @@ -102988,9 +103854,13 @@ class FieldTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; typeDef = () => { const ctx = this._ctx.select("typeDef"); @@ -103081,9 +103951,13 @@ class File extends BaseClient { const response = await ctx.execute(); return response; }; - stat = () => { - const ctx = this._ctx.select("stat"); - return new Stat(ctx); + stat = async () => { + const ctx = this._ctx.select("stat").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -103162,9 +104036,13 @@ class Function_ extends BaseClient { const ctx = this._ctx.select("returnType"); return new TypeDef(ctx); }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -103174,6 +104052,10 @@ class Function_ extends BaseClient { const response = await ctx.execute(); return response; }; + withAgent = () => { + const ctx = this._ctx.select("withAgent"); + return new Function_(ctx); + }; withArg = (name, typeDef, opts) => { const ctx = this._ctx.select("withArg", { name, typeDef, ...opts }); return new Function_(ctx); @@ -103293,9 +104175,13 @@ class FunctionArg extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; typeDef = () => { const ctx = this._ctx.select("typeDef"); @@ -103575,14 +104461,169 @@ class GeneratorGroup extends BaseClient { }; } +class GitCommit extends BaseClient { + _id = undefined; + _authorEmail = undefined; + _authorName = undefined; + _authoredDate = undefined; + _committedDate = undefined; + _committerEmail = undefined; + _committerName = undefined; + _message = undefined; + _messageBody = undefined; + _messageHeadline = undefined; + _sha = undefined; + _shortSha = undefined; + constructor(ctx, _id, _authorEmail, _authorName, _authoredDate, _committedDate, _committerEmail, _committerName, _message, _messageBody, _messageHeadline, _sha, _shortSha) { + super(ctx); + this._id = _id; + this._authorEmail = _authorEmail; + this._authorName = _authorName; + this._authoredDate = _authoredDate; + this._committedDate = _committedDate; + this._committerEmail = _committerEmail; + this._committerName = _committerName; + this._message = _message; + this._messageBody = _messageBody; + this._messageHeadline = _messageHeadline; + this._sha = _sha; + this._shortSha = _shortSha; + } + id = async () => { + if (this._id) { + return this._id; + } + const ctx = this._ctx.select("id"); + const response = await ctx.execute(); + return response; + }; + ancestorReleaseTag = async (opts) => { + const ctx = this._ctx.select("ancestorReleaseTag", { ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")); + }; + authorEmail = async () => { + if (this._authorEmail) { + return this._authorEmail; + } + const ctx = this._ctx.select("authorEmail"); + const response = await ctx.execute(); + return response; + }; + authorName = async () => { + if (this._authorName) { + return this._authorName; + } + const ctx = this._ctx.select("authorName"); + const response = await ctx.execute(); + return response; + }; + authoredDate = async () => { + if (this._authoredDate) { + return this._authoredDate; + } + const ctx = this._ctx.select("authoredDate"); + const response = await ctx.execute(); + return response; + }; + committedDate = async () => { + if (this._committedDate) { + return this._committedDate; + } + const ctx = this._ctx.select("committedDate"); + const response = await ctx.execute(); + return response; + }; + committerEmail = async () => { + if (this._committerEmail) { + return this._committerEmail; + } + const ctx = this._ctx.select("committerEmail"); + const response = await ctx.execute(); + return response; + }; + committerName = async () => { + if (this._committerName) { + return this._committerName; + } + const ctx = this._ctx.select("committerName"); + const response = await ctx.execute(); + return response; + }; + message = async () => { + if (this._message) { + return this._message; + } + const ctx = this._ctx.select("message"); + const response = await ctx.execute(); + return response; + }; + messageBody = async () => { + if (this._messageBody) { + return this._messageBody; + } + const ctx = this._ctx.select("messageBody"); + const response = await ctx.execute(); + return response; + }; + messageHeadline = async () => { + if (this._messageHeadline) { + return this._messageHeadline; + } + const ctx = this._ctx.select("messageHeadline"); + const response = await ctx.execute(); + return response; + }; + parentShas = async () => { + const ctx = this._ctx.select("parentShas"); + const response = await ctx.execute(); + return response; + }; + releaseTag = async (opts) => { + const ctx = this._ctx.select("releaseTag", { ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")); + }; + sha = async () => { + if (this._sha) { + return this._sha; + } + const ctx = this._ctx.select("sha"); + const response = await ctx.execute(); + return response; + }; + shortSha = async () => { + if (this._shortSha) { + return this._shortSha; + } + const ctx = this._ctx.select("shortSha"); + const response = await ctx.execute(); + return response; + }; + tree = (opts) => { + const ctx = this._ctx.select("tree", { ...opts }); + return new Directory(ctx); + }; +} + class GitRef extends BaseClient { _id = undefined; _commit = undefined; + _commitSHA = undefined; + _name = undefined; _ref = undefined; - constructor(ctx, _id, _commit, _ref) { + constructor(ctx, _id, _commit, _commitSHA, _name, _ref) { super(ctx); this._id = _id; this._commit = _commit; + this._commitSHA = _commitSHA; + this._name = _name; this._ref = _ref; } id = async () => { @@ -103605,10 +104646,31 @@ class GitRef extends BaseClient { const response = await ctx.execute(); return response; }; + commitSHA = async () => { + if (this._commitSHA) { + return this._commitSHA; + } + const ctx = this._ctx.select("commitSHA"); + const response = await ctx.execute(); + return response; + }; commonAncestor = (other) => { const ctx = this._ctx.select("commonAncestor", { other }); return new GitRef(ctx); }; + log = async (opts) => { + const ctx = this._ctx.select("log", { ...opts }).select("id"); + const response = await ctx.execute(); + return response.map((r) => new GitCommit(ctx.copy().selectNode(r.id, "GitCommit"))); + }; + name = async () => { + if (this._name) { + return this._name; + } + const ctx = this._ctx.select("name"); + const response = await ctx.execute(); + return response; + }; ref = async () => { if (this._ref) { return this._ref; @@ -103617,6 +104679,10 @@ class GitRef extends BaseClient { const response = await ctx.execute(); return response; }; + targetCommit = () => { + const ctx = this._ctx.select("targetCommit"); + return new GitCommit(ctx); + }; tree = (opts) => { const ctx = this._ctx.select("tree", { ...opts }); return new Directory(ctx); @@ -103657,7 +104723,7 @@ class GitRepository extends BaseClient { }; commit = (id) => { const ctx = this._ctx.select("commit", { id }); - return new GitRef(ctx); + return new GitCommit(ctx); }; head = () => { const ctx = this._ctx.select("head"); @@ -103913,9 +104979,13 @@ class InterfaceTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -104022,25 +105092,29 @@ class JSONValue extends BaseClient { class LLM extends BaseClient { _id = undefined; + _contextTokens = undefined; _contextWindow = undefined; _hasPending = undefined; _lastReply = undefined; _model = undefined; _portableID = undefined; _provider = undefined; + _reasoningEffort = undefined; _replay = undefined; _sync = undefined; _tools = undefined; _transcript = undefined; - constructor(ctx, _id, _contextWindow, _hasPending, _lastReply, _model, _portableID, _provider, _replay, _sync, _tools, _transcript) { + constructor(ctx, _id, _contextTokens, _contextWindow, _hasPending, _lastReply, _model, _portableID, _provider, _reasoningEffort, _replay, _sync, _tools, _transcript) { super(ctx); this._id = _id; + this._contextTokens = _contextTokens; this._contextWindow = _contextWindow; this._hasPending = _hasPending; this._lastReply = _lastReply; this._model = _model; this._portableID = _portableID; this._provider = _provider; + this._reasoningEffort = _reasoningEffort; this._replay = _replay; this._sync = _sync; this._tools = _tools; @@ -104054,9 +105128,13 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - bindResult = (name) => { - const ctx = this._ctx.select("bindResult", { name }); - return new Binding(ctx); + contextTokens = async () => { + if (this._contextTokens) { + return this._contextTokens; + } + const ctx = this._ctx.select("contextTokens"); + const response = await ctx.execute(); + return response; }; contextWindow = async () => { if (this._contextWindow) { @@ -104066,10 +105144,6 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - env = () => { - const ctx = this._ctx.select("env"); - return new Env(ctx); - }; fork = (label) => { const ctx = this._ctx.select("fork", { label }); return new LLM(ctx); @@ -104123,11 +105197,24 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; + reasoningEffort = async () => { + if (this._reasoningEffort) { + return this._reasoningEffort; + } + const ctx = this._ctx.select("reasoningEffort"); + const response = await ctx.execute(); + return response; + }; replay = async () => { const ctx = this._ctx.select("replay"); const response = await ctx.execute(); return new LLM(ctx.copy().selectNode(response, "LLM")); }; + skills = async () => { + const ctx = this._ctx.select("skills").select("id"); + const response = await ctx.execute(); + return response.map((r) => new LLMSkill(ctx.copy().selectNode(r.id, "LLMSkill"))); + }; step = (opts) => { const ctx = this._ctx.select("step", { ...opts }); return new LLM(ctx); @@ -104157,17 +105244,6 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - withBlockedFunction = (typeName, function_) => { - const ctx = this._ctx.select("withBlockedFunction", { - typeName, - function: function_ - }); - return new LLM(ctx); - }; - withEnv = (env) => { - const ctx = this._ctx.select("withEnv", { env }); - return new LLM(ctx); - }; withMCPServer = (name, service) => { const ctx = this._ctx.select("withMCPServer", { name, service }); return new LLM(ctx); @@ -104176,10 +105252,6 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withModel", { model, ...opts }); return new LLM(ctx); }; - withObject = (tag, object) => { - const ctx = this._ctx.select("withObject", { tag, object }); - return new LLM(ctx); - }; withPrompt = (prompt) => { const ctx = this._ctx.select("withPrompt", { prompt }); return new LLM(ctx); @@ -104188,12 +105260,16 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withPromptFile", { file }); return new LLM(ctx); }; + withReasoningEffort = (effort) => { + const ctx = this._ctx.select("withReasoningEffort", { effort }); + return new LLM(ctx); + }; withResponse = (content, opts) => { const ctx = this._ctx.select("withResponse", { content, ...opts }); return new LLM(ctx); }; - withStaticTools = () => { - const ctx = this._ctx.select("withStaticTools"); + withSkills = (directory) => { + const ctx = this._ctx.select("withSkills", { directory }); return new LLM(ctx); }; withSystemPrompt = (prompt) => { @@ -104204,6 +105280,14 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withToolResult", { callId, content, errored }); return new LLM(ctx); }; + withTools = (object, opts) => { + const ctx = this._ctx.select("withTools", { object, ...opts }); + return new LLM(ctx); + }; + withWorkspace = (workspace) => { + const ctx = this._ctx.select("withWorkspace", { workspace }); + return new LLM(ctx); + }; withoutDefaultSystemPrompt = () => { const ctx = this._ctx.select("withoutDefaultSystemPrompt"); return new LLM(ctx); @@ -104216,6 +105300,10 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withoutSystemPrompts"); return new LLM(ctx); }; + workspace = () => { + const ctx = this._ctx.select("workspace"); + return new Workspace(ctx); + }; with = (arg) => { return arg(this); }; @@ -104342,6 +105430,42 @@ class LLMMessage extends BaseClient { }; } +class LLMSkill extends BaseClient { + _id = undefined; + _description = undefined; + _name = undefined; + constructor(ctx, _id, _description, _name) { + super(ctx); + this._id = _id; + this._description = _description; + this._name = _name; + } + id = async () => { + if (this._id) { + return this._id; + } + const ctx = this._ctx.select("id"); + const response = await ctx.execute(); + return response; + }; + description = async () => { + if (this._description) { + return this._description; + } + const ctx = this._ctx.select("description"); + const response = await ctx.execute(); + return response; + }; + name = async () => { + if (this._name) { + return this._name; + } + const ctx = this._ctx.select("name"); + const response = await ctx.execute(); + return response; + }; +} + class LLMTokenUsage extends BaseClient { _id = undefined; _cachedTokenReads = undefined; @@ -104546,13 +105670,21 @@ class Module_ extends BaseClient { const response = await ctx.execute(); return response.map((r) => new TypeDef(ctx.copy().selectNode(r.id, "TypeDef"))); }; - runtime = () => { - const ctx = this._ctx.select("runtime"); - return new Container(ctx); + runtime = async () => { + const ctx = this._ctx.select("runtime").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Container(ctx.copy().selectNode(response, "Container")); }; - sdk = () => { - const ctx = this._ctx.select("sdk"); - return new SDKConfig(ctx); + sdk = async () => { + const ctx = this._ctx.select("sdk").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")); }; serve = async (opts) => { if (this._serve) { @@ -104565,9 +105697,13 @@ class Module_ extends BaseClient { const ctx = this._ctx.select("services", { ...opts }); return new UpGroup(ctx); }; - source = () => { - const ctx = this._ctx.select("source"); - return new ModuleSource(ctx); + source = async () => { + const ctx = this._ctx.select("source").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ModuleSource(ctx.copy().selectNode(response, "ModuleSource")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -104767,6 +105903,10 @@ class ModuleSource extends BaseClient { const response = await ctx.execute(); return response; }; + generate = (workspace) => { + const ctx = this._ctx.select("generate", { workspace }); + return new Workspace(ctx); + }; generateLocalDependencies = (workspace) => { const ctx = this._ctx.select("generateLocalDependencies", { workspace }); return new Changeset(ctx); @@ -104855,9 +105995,13 @@ class ModuleSource extends BaseClient { const response = await ctx.execute(); return response; }; - sdk = () => { - const ctx = this._ctx.select("sdk"); - return new SDKConfig(ctx); + sdk = async () => { + const ctx = this._ctx.select("sdk").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")); }; sourceRootSubpath = async () => { if (this._sourceRootSubpath) { @@ -105020,9 +106164,13 @@ class ObjectTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - constructor_ = () => { - const ctx = this._ctx.select("constructor"); - return new Function_(ctx); + constructor_ = async () => { + const ctx = this._ctx.select("constructor").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Function_(ctx.copy().selectNode(response, "Function")); }; deprecated = async () => { if (this._deprecated) { @@ -105058,9 +106206,13 @@ class ObjectTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -105169,10 +106321,6 @@ class Client extends BaseClient { const ctx = this._ctx.select("container", { ...opts }); return new Container(ctx); }; - currentEnv = () => { - const ctx = this._ctx.select("currentEnv"); - return new Env(ctx); - }; currentFunctionCall = () => { const ctx = this._ctx.select("currentFunctionCall"); return new FunctionCall(ctx); @@ -105181,6 +106329,10 @@ class Client extends BaseClient { const ctx = this._ctx.select("currentModule"); return new CurrentModule(ctx); }; + currentNode = () => { + const ctx = this._ctx.select("currentNode"); + return new _NodeClient(ctx); + }; currentTypeDefs = async (opts) => { const ctx = this._ctx.select("currentTypeDefs", { ...opts }).select("id"); const response = await ctx.execute(); @@ -105203,9 +106355,9 @@ class Client extends BaseClient { const ctx = this._ctx.select("engine"); return new Engine(ctx); }; - env = (opts) => { - const ctx = this._ctx.select("env", { ...opts }); - return new Env(ctx); + engineVolume = (name, opts) => { + const ctx = this._ctx.select("engineVolume", { name, ...opts }); + return new Volume(ctx); }; envFile = (opts) => { const ctx = this._ctx.select("envFile", { ...opts }); @@ -105258,9 +106410,13 @@ class Client extends BaseClient { const ctx = this._ctx.select("moduleSource", { refString, ...opts, __metadata: metadata }); return new ModuleSource(ctx); }; - node = (id) => { - const ctx = this._ctx.select("node", { id }); - return new _NodeClient(ctx); + node = async (id) => { + const ctx = this._ctx.select("node", { id }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new _NodeClient(ctx.copy().selectNode(response, "Node")); }; schema = (json) => { const ctx = this._ctx.select("schema", { json }); @@ -105863,29 +107019,53 @@ class TypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - asEnum = () => { - const ctx = this._ctx.select("asEnum"); - return new EnumTypeDef(ctx); + asEnum = async () => { + const ctx = this._ctx.select("asEnum").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new EnumTypeDef(ctx.copy().selectNode(response, "EnumTypeDef")); }; - asInput = () => { - const ctx = this._ctx.select("asInput"); - return new InputTypeDef(ctx); + asInput = async () => { + const ctx = this._ctx.select("asInput").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new InputTypeDef(ctx.copy().selectNode(response, "InputTypeDef")); }; - asInterface = () => { - const ctx = this._ctx.select("asInterface"); - return new InterfaceTypeDef(ctx); + asInterface = async () => { + const ctx = this._ctx.select("asInterface").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new InterfaceTypeDef(ctx.copy().selectNode(response, "InterfaceTypeDef")); }; - asList = () => { - const ctx = this._ctx.select("asList"); - return new ListTypeDef(ctx); + asList = async () => { + const ctx = this._ctx.select("asList").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ListTypeDef(ctx.copy().selectNode(response, "ListTypeDef")); }; - asObject = () => { - const ctx = this._ctx.select("asObject"); - return new ObjectTypeDef(ctx); + asObject = async () => { + const ctx = this._ctx.select("asObject").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ObjectTypeDef(ctx.copy().selectNode(response, "ObjectTypeDef")); }; - asScalar = () => { - const ctx = this._ctx.select("asScalar"); - return new ScalarTypeDef(ctx); + asScalar = async () => { + const ctx = this._ctx.select("asScalar").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ScalarTypeDef(ctx.copy().selectNode(response, "ScalarTypeDef")); }; kind = async () => { if (this._kind) { @@ -106101,8 +107281,12 @@ class Workspace extends BaseClient { const response = await ctx.execute(); return response; }; - changes = () => { - const ctx = this._ctx.select("changes"); + agents = (opts) => { + const ctx = this._ctx.select("agents", { ...opts }); + return new AgentGroup(ctx); + }; + changes = (opts) => { + const ctx = this._ctx.select("changes", { ...opts }); return new Changeset(ctx); }; checks = (opts) => { @@ -106153,6 +107337,11 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("file", { path }); return new File(ctx); }; + findRoots = async (opts) => { + const ctx = this._ctx.select("findRoots", { ...opts }); + const response = await ctx.execute(); + return response; + }; findUp = async (name, opts) => { if (this._findUp) { return this._findUp; @@ -106191,6 +107380,10 @@ class Workspace extends BaseClient { const response = await ctx.execute(); return response.map((r) => new WorkspaceModule(ctx.copy().selectNode(r.id, "WorkspaceModule"))); }; + reloaded = () => { + const ctx = this._ctx.select("reloaded"); + return new Workspace(ctx); + }; sdk = (name) => { const ctx = this._ctx.select("sdk", { name }); return new WorkspaceSDK(ctx); @@ -106238,6 +107431,14 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("withModule", { ref, ...opts }); return new Workspace(ctx); }; + withMountedDirectory = (path, source) => { + const ctx = this._ctx.select("withMountedDirectory", { path, source }); + return new Workspace(ctx); + }; + withMountedFile = (path, source) => { + const ctx = this._ctx.select("withMountedFile", { path, source }); + return new Workspace(ctx); + }; withNewDirectory = (path, source) => { const ctx = this._ctx.select("withNewDirectory", { path, source }); return new Workspace(ctx); @@ -106266,6 +107467,14 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("withoutConfigValue", { key, ...opts }); return new Workspace(ctx); }; + withoutDirectory = (path) => { + const ctx = this._ctx.select("withoutDirectory", { path }); + return new Workspace(ctx); + }; + withoutFile = (path) => { + const ctx = this._ctx.select("withoutFile", { path }); + return new Workspace(ctx); + }; withoutModule = (name, opts) => { const ctx = this._ctx.select("withoutModule", { name, ...opts }); return new Workspace(ctx); @@ -106614,6 +107823,9 @@ class Registry { up = () => { return (target, propertyKey, descriptor) => descriptor; }; + agent = () => { + return (target, propertyKey, descriptor) => {}; + }; argument = (opts) => { return (target, propertyKey, parameterIndex) => {}; }; @@ -106654,6 +107866,7 @@ var func = registry.func; var check = registry.check; var generate = registry.generate; var up = registry.up; +var agent = registry.agent; var field = registry.field; var enumType = registry.enumType; var argument = registry.argument; @@ -107262,6 +108475,7 @@ var FUNCTION_DECORATOR = func.name; var CHECK_DECORATOR = check.name; var GENERATOR_DECORATOR = generate.name; var UP_DECORATOR = up.name; +var AGENT_DECORATOR = agent.name; var FIELD_DECORATOR = field.name; var ARGUMENT_DECORATOR = argument.name; var ENUM_DECORATOR = enumType.name; @@ -107571,6 +108785,7 @@ class DaggerFunction extends Locatable { isCheck = false; isGenerator = false; isUp = false; + isAgent = false; signature; symbol; constructor(node, ast2) { @@ -107601,6 +108816,9 @@ class DaggerFunction extends Locatable { if (this.ast.isNodeDecoratedWith(this.node, UP_DECORATOR)) { this.isUp = true; } + if (this.ast.isNodeDecoratedWith(this.node, AGENT_DECORATOR)) { + this.isAgent = true; + } for (const parameter of this.node.parameters) { this.arguments[parameter.name.getText()] = new DaggerArgument(parameter, this.ast); } @@ -108636,6 +109854,9 @@ class Register { if (fct.isUp) { fnDef = fnDef.withUp(); } + if (fct.isAgent) { + fnDef = fnDef.withAgent(); + } return fnDef; } addArg(args) { @@ -108794,6 +110015,7 @@ export { connect, check, argument, + agent, _SyncerClient, _NodeClient, _ExportableClient, @@ -108832,6 +110054,9 @@ export { RegistryProtocolNameToValue, RegistryProtocol, Port, + PatchConflictValueToName, + PatchConflictNameToValue, + PatchConflict, ObjectTypeDef, NotAwaitedRequestError, NetworkProtocolValueToName, @@ -108849,6 +110074,7 @@ export { ListTypeDef, Label, LLMTokenUsage, + LLMSkill, LLMMessageRoleValueToName, LLMMessageRoleNameToValue, LLMMessageRole, @@ -108876,6 +110102,7 @@ export { GraphQLClient, GitRepository, GitRef, + GitCommit, GeneratorGroup, Generator, GeneratedCode, @@ -108900,7 +110127,6 @@ export { Error2 as Error, EnvVariable, EnvFile, - Env, EnumValueTypeDef, EnumTypeDef, EngineSessionError, @@ -108940,7 +110166,8 @@ export { CacheSharingModeValueToName, CacheSharingModeNameToValue, CacheSharingMode, - Binding, BaseClient, + AgentGroup, + Agent, Address }; diff --git a/library/bundle/index.ts b/library/bundle/index.ts index 6c13820..abdf4ed 100644 --- a/library/bundle/index.ts +++ b/library/bundle/index.ts @@ -6,6 +6,7 @@ export { check, generate, up, + agent, argument, object, field, diff --git a/library/bundle/introspector.js b/library/bundle/introspector.js index e71c2e2..0b77dcf 100644 --- a/library/bundle/introspector.js +++ b/library/bundle/introspector.js @@ -26067,38 +26067,42 @@ var require_utils3 = __commonJS((exports, module) => { if (exist && !overwrite) return callback(false); self2.fs.stat(path, function(err, stat2) { - if (exist && stat2.isDirectory()) { + if (exist && stat2 && stat2.isDirectory()) { return callback(false); } var folder = pth.dirname(path); self2.fs.exists(folder, function(exists) { - if (!exists) - self2.makeDir(folder); + if (!exists) { + try { + self2.makeDir(folder); + } catch (e2) { + return callback(false); + } + } + const writeToFd = function(fd) { + self2.fs.write(fd, content, 0, content.length, 0, function(writeErr) { + self2.fs.close(fd, function() { + if (writeErr) + return callback(false); + self2.fs.chmod(path, attr || 438, function() { + callback(true); + }); + }); + }); + }; self2.fs.open(path, "w", 438, function(err2, fd) { if (err2) { self2.fs.chmod(path, 438, function() { - self2.fs.open(path, "w", 438, function(err3, fd2) { - self2.fs.write(fd2, content, 0, content.length, 0, function() { - self2.fs.close(fd2, function() { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); - }); - }); + self2.fs.open(path, "w", 438, function(retryErr, fd2) { + if (retryErr || !fd2) + return callback(false); + writeToFd(fd2); }); }); } else if (fd) { - self2.fs.write(fd, content, 0, content.length, 0, function() { - self2.fs.close(fd, function() { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); - }); - }); + writeToFd(fd); } else { - self2.fs.chmod(path, attr || 438, function() { - callback(true); - }); + callback(false); } }); }); @@ -26107,7 +26111,7 @@ var require_utils3 = __commonJS((exports, module) => { }; Utils.prototype.findFiles = function(path) { const self2 = this; - function findSync(dir, pattern, recursive) { + function findSync(dir, pattern, recursive, visited) { if (typeof pattern === "boolean") { recursive = pattern; pattern = undefined; @@ -26119,44 +26123,75 @@ var require_utils3 = __commonJS((exports, module) => { if (!pattern || pattern.test(path2)) { files2.push(pth.normalize(path2) + (stat2.isDirectory() ? self2.sep : "")); } - if (stat2.isDirectory() && recursive) - files2 = files2.concat(findSync(path2, pattern, recursive)); + if (stat2.isDirectory() && recursive) { + const realDir = self2.fs.realpathSync(path2); + if (!visited.has(realDir)) { + visited.add(realDir); + files2 = files2.concat(findSync(path2, pattern, recursive, visited)); + } + } }); return files2; } - return findSync(path, undefined, true); + return findSync(path, undefined, true, new Set([self2.fs.realpathSync(path)])); }; Utils.prototype.findFilesAsync = function(dir, cb) { const self2 = this; - let results = []; - self2.fs.readdir(dir, function(err, list) { - if (err) - return cb(err); - let list_length = list.length; - if (!list_length) - return cb(null, results); - list.forEach(function(file) { - file = pth.join(dir, file); - self2.fs.stat(file, function(err2, stat2) { - if (err2) - return cb(err2); - if (stat2) { + const results = []; + let finished = false; + const finish = function(err) { + if (finished) + return; + finished = true; + cb(err, err ? undefined : results); + }; + const walk = function(dir2, visited, done) { + self2.fs.readdir(dir2, function(err, list) { + if (err) + return done(err); + let pending = list.length; + if (!pending) + return done(); + list.forEach(function(name) { + const file = pth.join(dir2, name); + self2.fs.stat(file, function(err2, stat2) { + if (err2) + return done(err2); + if (!stat2) { + if (!--pending) + done(); + return; + } results.push(pth.normalize(file) + (stat2.isDirectory() ? self2.sep : "")); - if (stat2.isDirectory()) { - self2.findFilesAsync(file, function(err3, res) { - if (err3) - return cb(err3); - results = results.concat(res); - if (!--list_length) - cb(null, results); - }); - } else { - if (!--list_length) - cb(null, results); + if (!stat2.isDirectory()) { + if (!--pending) + done(); + return; } - } + self2.fs.realpath(file, function(err3, realDir) { + if (err3) + return done(err3); + if (visited.has(realDir)) { + if (!--pending) + done(); + return; + } + visited.add(realDir); + walk(file, visited, function(err4) { + if (err4) + return done(err4); + if (!--pending) + done(); + }); + }); + }); }); }); + }; + self2.fs.realpath(dir, function(err, realDir) { + if (err) + return finish(err); + walk(dir, new Set([realDir]), finish); }); }; Utils.prototype.getAttributes = function() {}; @@ -26941,35 +26976,8 @@ var require_zipEntry = __commonJS((exports, module) => { return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize); } function crc32OK(data) { - if (!_centralHeader.flags_desc && !_centralHeader.localHeader.flags_desc) { - if (Utils.crc32(data) !== _centralHeader.localHeader.crc) { - return false; - } - } else { - const descriptor = {}; - const dataEndOffset = _centralHeader.realDataOffset + _centralHeader.compressedSize; - if (input.readUInt32LE(dataEndOffset) == Constants.LOCSIG || input.readUInt32LE(dataEndOffset) == Constants.CENSIG) { - throw Utils.Errors.DESCRIPTOR_NOT_EXIST(); - } - if (input.readUInt32LE(dataEndOffset) == Constants.EXTSIG) { - descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC); - descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ); - descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN); - } else if (input.readUInt16LE(dataEndOffset + 12) === 19280) { - descriptor.crc = input.readUInt32LE(dataEndOffset + Constants.EXTCRC - 4); - descriptor.compressedSize = input.readUInt32LE(dataEndOffset + Constants.EXTSIZ - 4); - descriptor.size = input.readUInt32LE(dataEndOffset + Constants.EXTLEN - 4); - } else { - throw Utils.Errors.DESCRIPTOR_UNKNOWN(); - } - if (descriptor.compressedSize !== _centralHeader.compressedSize || descriptor.size !== _centralHeader.size || descriptor.crc !== _centralHeader.crc) { - throw Utils.Errors.DESCRIPTOR_FAULTY(); - } - if (Utils.crc32(data) !== descriptor.crc) { - return false; - } - } - return true; + const expectedCrc = _centralHeader.flags_desc || _centralHeader.localHeader.flags_desc ? _centralHeader.crc : _centralHeader.localHeader.crc; + return Utils.crc32(data) === expectedCrc; } function decompress(async, callback, pass) { if (typeof callback === "undefined" && typeof async === "string") { @@ -26994,9 +27002,10 @@ var require_zipEntry = __commonJS((exports, module) => { } compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass); } - var data = Buffer.alloc(_centralHeader.size); + var data; switch (_centralHeader.method) { case Utils.Constants.STORED: + data = Buffer.alloc(compressedData.length); compressedData.copy(data); if (!crc32OK(data)) { if (async && callback) @@ -27010,15 +27019,13 @@ var require_zipEntry = __commonJS((exports, module) => { case Utils.Constants.DEFLATED: var inflater = new Methods.Inflater(compressedData, _centralHeader.size); if (!async) { - const result = inflater.inflate(data); - result.copy(data, 0); + data = inflater.inflate(); if (!crc32OK(data)) { throw Utils.Errors.BAD_CRC(`"${decoder.decode(_entryName)}"`); } return data; } else { inflater.inflateAsync(function(result) { - result.copy(result, 0); if (callback) { if (!crc32OK(result)) { callback(result, Utils.Errors.BAD_CRC()); @@ -27162,8 +27169,8 @@ var require_zipEntry = __commonJS((exports, module) => { throw Utils.Errors.COMMENT_TOO_LONG(); }, get name() { - var n = decoder.decode(_entryName); - return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); + const n = decoder.decode(_entryName); + return _isDirectory ? n.replace(/[/\\]$/, "").split("/").pop() : n.split("/").pop(); }, get isDirectory() { return _isDirectory; @@ -27264,7 +27271,7 @@ var require_zipFile = __commonJS((exports, module) => { var Headers3 = require_headers(); var Utils = require_util(); module.exports = function(inBuffer, options) { - var entryList = [], entryTable = {}, _comment = Buffer.alloc(0), mainHeader = new Headers3.MainHeader, loadedEntries = false; + var entryList = [], entryTable = Object.create(null), _comment = Buffer.alloc(0), mainHeader = new Headers3.MainHeader, loadedEntries = false; var password = null; const temporary = new Set; const opts = options; @@ -27300,7 +27307,7 @@ var require_zipFile = __commonJS((exports, module) => { } function readEntries() { loadedEntries = true; - entryTable = {}; + entryTable = Object.create(null); if (mainHeader.diskEntries > (inBuffer.length - mainHeader.offset) / Utils.Constants.CENHDR) { throw Utils.Errors.DISK_ENTRY_TOO_LARGE(); } @@ -27358,7 +27365,7 @@ var require_zipFile = __commonJS((exports, module) => { } function sortEntries() { if (entryList.length > 1 && !noSort) { - entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); + entryList = entryList.map((entry) => ({ entry, key: entry.entryName.toLowerCase() })).sort((a, b) => a.key.localeCompare(b.key)).map((pair) => pair.entry); } } return { @@ -27594,6 +27601,9 @@ var require_adm_zip = __commonJS((exports, module) => { } Object.assign(opts, options); const filetools = new Utils(opts); + const applyDirAttributes = (dirEntries) => { + dirEntries.filter((d) => d.attr).sort((a, b) => b.path.length - a.path.length).forEach((d) => filetools.fs.chmodSync(d.path, d.attr)); + }; if (typeof opts.decoder !== "object" || typeof opts.decoder.encode !== "function" || typeof opts.decoder.decode !== "function") { opts.decoder = Utils.decoder; } @@ -27958,8 +27968,8 @@ var require_adm_zip = __commonJS((exports, module) => { if (!content2) { throw Utils.Errors.CANT_EXTRACT_FILE(); } - var name = canonical(child.entryName); - var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name)); + var name = canonical(maintainEntryPath ? child.entryName : child.entryName.substring(item.entryName.length)); + var childName = sanitize(targetPath, name); const fileAttr2 = keepOriginalPermission ? child.header.fileAttr : undefined; filetools.writeFileTo(childName, content2, overwrite, fileAttr2); }); @@ -27984,7 +27994,7 @@ var require_adm_zip = __commonJS((exports, module) => { if (entry.isDirectory) { continue; } - var content = _zip.entries[entry].getData(pass); + var content = entry.getData(pass); if (!content) { return false; } @@ -28000,10 +28010,13 @@ var require_adm_zip = __commonJS((exports, module) => { overwrite = get_Bool(false, overwrite); if (!_zip) throw Utils.Errors.NO_ZIP(); + const dirEntries = []; _zip.entries.forEach(function(entry) { var entryName = sanitize(targetPath, canonical(entry.entryName)); if (entry.isDirectory) { filetools.makeDir(entryName); + if (keepOriginalPermission) + dirEntries.push({ path: entryName, attr: entry.header.fileAttr }); return; } var content = entry.getData(pass); @@ -28014,10 +28027,9 @@ var require_adm_zip = __commonJS((exports, module) => { filetools.writeFileTo(entryName, content, overwrite, fileAttr); try { filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time); - } catch (err) { - throw Utils.Errors.CANT_EXTRACT_FILE(); - } + } catch (err) {} }); + applyDirAttributes(dirEntries); }, extractAllToAsync: function(targetPath, overwrite, keepOriginalPermission, callback) { callback = get_Fun(overwrite, keepOriginalPermission, callback); @@ -28050,18 +28062,32 @@ var require_adm_zip = __commonJS((exports, module) => { fileEntries.push(e2); } }); + const deferredDirAttr = []; for (const entry of dirEntries) { const dirPath = getPath(entry); const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; try { filetools.makeDir(dirPath); - if (dirAttr) - filetools.fs.chmodSync(dirPath, dirAttr); - filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); } catch (er) { callback(getError("Unable to create folder", dirPath)); + continue; } + if (dirAttr) + deferredDirAttr.push({ path: dirPath, attr: dirAttr }); + try { + filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); + } catch (er) {} } + const done = (err) => { + if (!err) { + try { + applyDirAttributes(deferredDirAttr); + } catch (er) { + return callback(getError("Unable to set folder permissions", er.path || "")); + } + } + callback(err); + }; fileEntries.reverse().reduce(function(next, entry) { return function(err) { if (err) { @@ -28078,21 +28104,17 @@ var require_adm_zip = __commonJS((exports, module) => { const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function(succ) { if (!succ) { - next(getError("Unable to write file", filePath)); + return next(getError("Unable to write file", filePath)); } - filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function(err_2) { - if (err_2) { - next(getError("Unable to set times", filePath)); - } else { - next(); - } + filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function() { + next(); }); }); } }); } }; - }, callback)(); + }, done)(); }, writeZip: function(targetFileName, callback) { if (arguments.length === 1) { @@ -38917,7 +38939,7 @@ var init_bin = __esm(() => { }); // src/provisioning/default.ts -var CLI_VERSION = "1.0.0-beta.9"; +var CLI_VERSION = "1.0.0-beta.10"; // src/provisioning/index.ts var exports_provisioning = {}; @@ -48266,12 +48288,12 @@ var require_otlp_node_http_configuration = __commonJS((exports) => { return async (protocol) => { const isInsecure = protocol === "http:"; const module2 = isInsecure ? import("http") : import("https"); - const { Agent } = await module2; + const { Agent: Agent2 } = await module2; if (isInsecure) { const { ca, cert, key, ...insecureOptions } = options; - return new Agent(insecureOptions); + return new Agent2(insecureOptions); } - return new Agent(options); + return new Agent2(options); }; } exports.httpAgentFactoryFromOptions = httpAgentFactoryFromOptions; @@ -79195,249 +79217,1630 @@ var require_src27 = __commonJS((exports) => { } }); }); -// node_modules/@opentelemetry/propagator-jaeger/build/src/JaegerPropagator.js -var require_JaegerPropagator = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.js +var require_suppress_tracing2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.JaegerPropagator = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.UBER_TRACE_ID_HEADER = undefined; + exports.isTracingSuppressed = exports.unsuppressTracing = exports.suppressTracing = undefined; var api_1 = require_src(); - var core_1 = require_src3(); - exports.UBER_TRACE_ID_HEADER = "uber-trace-id"; - exports.UBER_BAGGAGE_HEADER_PREFIX = "uberctx"; + var SUPPRESS_TRACING_KEY = (0, api_1.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING"); + function suppressTracing(context2) { + return context2.setValue(SUPPRESS_TRACING_KEY, true); + } + exports.suppressTracing = suppressTracing; + function unsuppressTracing(context2) { + return context2.deleteValue(SUPPRESS_TRACING_KEY); + } + exports.unsuppressTracing = unsuppressTracing; + function isTracingSuppressed(context2) { + return context2.getValue(SUPPRESS_TRACING_KEY) === true; + } + exports.isTracingSuppressed = isTracingSuppressed; +}); - class JaegerPropagator { - _jaegerTraceHeader; - _jaegerBaggageHeaderPrefix; - constructor(config) { - if (typeof config === "string") { - this._jaegerTraceHeader = config; - this._jaegerBaggageHeaderPrefix = exports.UBER_BAGGAGE_HEADER_PREFIX; - } else { - this._jaegerTraceHeader = config?.customTraceHeader || exports.UBER_TRACE_ID_HEADER; - this._jaegerBaggageHeaderPrefix = config?.customBaggageHeaderPrefix || exports.UBER_BAGGAGE_HEADER_PREFIX; +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/constants.js +var require_constants5 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.BAGGAGE_MAX_TOTAL_LENGTH = exports.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = exports.BAGGAGE_MAX_NAME_VALUE_PAIRS = exports.BAGGAGE_HEADER = exports.BAGGAGE_ITEMS_SEPARATOR = exports.BAGGAGE_PROPERTIES_SEPARATOR = exports.BAGGAGE_KEY_PAIR_SEPARATOR = undefined; + exports.BAGGAGE_KEY_PAIR_SEPARATOR = "="; + exports.BAGGAGE_PROPERTIES_SEPARATOR = ";"; + exports.BAGGAGE_ITEMS_SEPARATOR = ","; + exports.BAGGAGE_HEADER = "baggage"; + exports.BAGGAGE_MAX_NAME_VALUE_PAIRS = 180; + exports.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096; + exports.BAGGAGE_MAX_TOTAL_LENGTH = 8192; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/utils.js +var require_utils14 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseKeyPairsIntoRecord = exports.parseBaggageHeaderString = exports.parsePairKeyValue = exports.getKeyPairs = exports.serializeKeyPairs = undefined; + var api_1 = require_src(); + var constants_1 = require_constants5(); + function serializeKeyPairs(keyPairs) { + return keyPairs.reduce((hValue, current) => { + const value = `${hValue}${hValue !== "" ? constants_1.BAGGAGE_ITEMS_SEPARATOR : ""}${current}`; + return value.length > constants_1.BAGGAGE_MAX_TOTAL_LENGTH ? hValue : value; + }, ""); + } + exports.serializeKeyPairs = serializeKeyPairs; + function getKeyPairs(baggage) { + return baggage.getAllEntries().map(([key, value]) => { + let entry = `${encodeURIComponent(key)}=${encodeURIComponent(value.value)}`; + if (value.metadata !== undefined) { + entry += constants_1.BAGGAGE_PROPERTIES_SEPARATOR + value.metadata.toString(); + } + return entry; + }); + } + exports.getKeyPairs = getKeyPairs; + function parsePairKeyValue(entry) { + if (!entry) + return; + const metadataSeparatorIndex = entry.indexOf(constants_1.BAGGAGE_PROPERTIES_SEPARATOR); + const keyPairPart = metadataSeparatorIndex === -1 ? entry : entry.substring(0, metadataSeparatorIndex); + const separatorIndex = keyPairPart.indexOf(constants_1.BAGGAGE_KEY_PAIR_SEPARATOR); + if (separatorIndex <= 0) + return; + const rawKey = keyPairPart.substring(0, separatorIndex).trim(); + const rawValue = keyPairPart.substring(separatorIndex + 1).trim(); + if (!rawKey || !rawValue) + return; + let key; + let value; + try { + key = decodeURIComponent(rawKey); + value = decodeURIComponent(rawValue); + } catch { + return; + } + let metadata; + if (metadataSeparatorIndex !== -1 && metadataSeparatorIndex < entry.length - 1) { + const metadataString = entry.substring(metadataSeparatorIndex + 1); + metadata = (0, api_1.baggageEntryMetadataFromString)(metadataString); + } + return { key, value, metadata }; + } + exports.parsePairKeyValue = parsePairKeyValue; + function parseBaggageHeaderString(value, baggage, count2, totalSize) { + let start = 0; + while (start < value.length && count2 < constants_1.BAGGAGE_MAX_NAME_VALUE_PAIRS) { + const end = value.indexOf(constants_1.BAGGAGE_ITEMS_SEPARATOR, start); + const entryEnd = end === -1 ? value.length : end; + const entryLength = entryEnd - start; + if (entryLength <= constants_1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS) { + const keyPair = parsePairKeyValue(value.substring(start, entryEnd)); + if (keyPair) { + const entrySize = (count2 === 0 ? 0 : 1) + entryLength; + if (totalSize + entrySize > constants_1.BAGGAGE_MAX_TOTAL_LENGTH) + break; + baggage[keyPair.key] = keyPair.metadata ? { value: keyPair.value, metadata: keyPair.metadata } : { value: keyPair.value }; + count2++; + totalSize += entrySize; + } } + if (end === -1) + break; + start = end + 1; + } + return [count2, totalSize]; + } + exports.parseBaggageHeaderString = parseBaggageHeaderString; + function parseKeyPairsIntoRecord(value) { + const result = {}; + if (typeof value === "string" && value.length > 0) { + value.split(constants_1.BAGGAGE_ITEMS_SEPARATOR).forEach((entry) => { + const keyPair = parsePairKeyValue(entry); + if (keyPair !== undefined && keyPair.value.length > 0) { + result[keyPair.key] = keyPair.value; + } + }); } + return result; + } + exports.parseKeyPairsIntoRecord = parseKeyPairsIntoRecord; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.js +var require_W3CBaggagePropagator2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.W3CBaggagePropagator = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + var constants_1 = require_constants5(); + var utils_1 = require_utils14(); + + class W3CBaggagePropagator { inject(context2, carrier, setter) { - const spanContext = api_1.trace.getSpanContext(context2); const baggage = api_1.propagation.getBaggage(context2); - if (spanContext && (0, core_1.isTracingSuppressed)(context2) === false) { - const traceFlags = `0${(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`; - setter.set(carrier, this._jaegerTraceHeader, `${spanContext.traceId}:${spanContext.spanId}:0:${traceFlags}`); - } - if (baggage) { - for (const [key, entry] of baggage.getAllEntries()) { - setter.set(carrier, `${this._jaegerBaggageHeaderPrefix}-${key}`, encodeURIComponent(entry.value)); - } + if (!baggage || (0, suppress_tracing_1.isTracingSuppressed)(context2)) + return; + const keyPairs = (0, utils_1.getKeyPairs)(baggage).filter((pair) => { + return pair.length <= constants_1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS; + }).slice(0, constants_1.BAGGAGE_MAX_NAME_VALUE_PAIRS); + const headerValue = (0, utils_1.serializeKeyPairs)(keyPairs); + if (headerValue.length > 0) { + setter.set(carrier, constants_1.BAGGAGE_HEADER, headerValue); } } extract(context2, carrier, getter) { - const uberTraceIdHeader = getter.get(carrier, this._jaegerTraceHeader); - const uberTraceId = Array.isArray(uberTraceIdHeader) ? uberTraceIdHeader[0] : uberTraceIdHeader; - const baggageValues = getter.keys(carrier).filter((key) => key.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((key) => { - const value = getter.get(carrier, key); - return { - key: key.substring(this._jaegerBaggageHeaderPrefix.length + 1), - value: Array.isArray(value) ? value[0] : value - }; - }); - let newContext = context2; - if (typeof uberTraceId === "string") { - const spanContext = deserializeSpanContext(uberTraceId); - if (spanContext) { - newContext = api_1.trace.setSpanContext(newContext, spanContext); + const headerValue = getter.get(carrier, constants_1.BAGGAGE_HEADER); + if (!headerValue) { + return context2; + } + const baggage = {}; + let count2 = 0; + let totalSize = 0; + if (Array.isArray(headerValue)) { + for (let i3 = 0;i3 < headerValue.length; i3++) { + [count2, totalSize] = (0, utils_1.parseBaggageHeaderString)(headerValue[i3], baggage, count2, totalSize); } + } else { + [count2] = (0, utils_1.parseBaggageHeaderString)(headerValue, baggage, count2, totalSize); } - if (baggageValues.length === 0) - return newContext; - let currentBaggage = api_1.propagation.getBaggage(context2) ?? api_1.propagation.createBaggage(); - for (const baggageEntry of baggageValues) { - if (baggageEntry.value === undefined) - continue; - currentBaggage = currentBaggage.setEntry(baggageEntry.key, { - value: decodeURIComponent(baggageEntry.value) - }); + if (count2 === 0) { + return context2; } - newContext = api_1.propagation.setBaggage(newContext, currentBaggage); - return newContext; + return api_1.propagation.setBaggage(context2, api_1.propagation.createBaggage(baggage)); } fields() { - return [this._jaegerTraceHeader]; - } - } - exports.JaegerPropagator = JaegerPropagator; - var VALID_HEX_RE = /^[0-9a-f]{1,2}$/i; - function deserializeSpanContext(serializedString) { - const headers = decodeURIComponent(serializedString).split(":"); - if (headers.length !== 4) { - return null; + return [constants_1.BAGGAGE_HEADER]; } - const [_traceId, _spanId, , flags] = headers; - const traceId = _traceId.padStart(32, "0"); - const spanId = _spanId.padStart(16, "0"); - const traceFlags = VALID_HEX_RE.test(flags) ? parseInt(flags, 16) & 1 : 1; - return { traceId, spanId, isRemote: true, traceFlags }; } + exports.W3CBaggagePropagator = W3CBaggagePropagator; }); -// node_modules/@opentelemetry/propagator-jaeger/build/src/index.js -var require_src28 = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/anchored-clock.js +var require_anchored_clock2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.UBER_TRACE_ID_HEADER = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.JaegerPropagator = undefined; - var JaegerPropagator_1 = require_JaegerPropagator(); - Object.defineProperty(exports, "JaegerPropagator", { enumerable: true, get: function() { - return JaegerPropagator_1.JaegerPropagator; - } }); - Object.defineProperty(exports, "UBER_BAGGAGE_HEADER_PREFIX", { enumerable: true, get: function() { - return JaegerPropagator_1.UBER_BAGGAGE_HEADER_PREFIX; - } }); - Object.defineProperty(exports, "UBER_TRACE_ID_HEADER", { enumerable: true, get: function() { - return JaegerPropagator_1.UBER_TRACE_ID_HEADER; - } }); -}); + exports.AnchoredClock = undefined; -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/OTLPMetricExporterOptions.js -var require_OTLPMetricExporterOptions = __commonJS((exports) => { - Object.defineProperty(exports, "__esModule", { value: true }); - exports.AggregationTemporalityPreference = undefined; - var AggregationTemporalityPreference; - (function(AggregationTemporalityPreference2) { - AggregationTemporalityPreference2[AggregationTemporalityPreference2["DELTA"] = 0] = "DELTA"; - AggregationTemporalityPreference2[AggregationTemporalityPreference2["CUMULATIVE"] = 1] = "CUMULATIVE"; - AggregationTemporalityPreference2[AggregationTemporalityPreference2["LOWMEMORY"] = 2] = "LOWMEMORY"; - })(AggregationTemporalityPreference = exports.AggregationTemporalityPreference || (exports.AggregationTemporalityPreference = {})); + class AnchoredClock { + _monotonicClock; + _epochMillis; + _performanceMillis; + constructor(systemClock, monotonicClock) { + this._monotonicClock = monotonicClock; + this._epochMillis = systemClock.now(); + this._performanceMillis = monotonicClock.now(); + } + now() { + const delta = this._monotonicClock.now() - this._performanceMillis; + return this._epochMillis + delta; + } + } + exports.AnchoredClock = AnchoredClock; }); -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/OTLPMetricExporterBase.js -var require_OTLPMetricExporterBase = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/attributes.js +var require_attributes2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = undefined; - var core_1 = require_src3(); - var sdk_metrics_1 = require_src7(); - var OTLPMetricExporterOptions_1 = require_OTLPMetricExporterOptions(); - var otlp_exporter_base_1 = require_src4(); + exports.isAttributeValue = exports.isAttributeKey = exports.sanitizeAttributes = undefined; var api_1 = require_src(); - var CumulativeTemporalitySelector = () => sdk_metrics_1.AggregationTemporality.CUMULATIVE; - exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector; - var DeltaTemporalitySelector = (instrumentType) => { - switch (instrumentType) { - case sdk_metrics_1.InstrumentType.COUNTER: - case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER: - case sdk_metrics_1.InstrumentType.GAUGE: - case sdk_metrics_1.InstrumentType.HISTOGRAM: - case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE: - return sdk_metrics_1.AggregationTemporality.DELTA; - case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER: - case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: - return sdk_metrics_1.AggregationTemporality.CUMULATIVE; - } - }; - exports.DeltaTemporalitySelector = DeltaTemporalitySelector; - var LowMemoryTemporalitySelector = (instrumentType) => { - switch (instrumentType) { - case sdk_metrics_1.InstrumentType.COUNTER: - case sdk_metrics_1.InstrumentType.HISTOGRAM: - return sdk_metrics_1.AggregationTemporality.DELTA; - case sdk_metrics_1.InstrumentType.GAUGE: - case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER: - case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: - case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER: - case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE: - return sdk_metrics_1.AggregationTemporality.CUMULATIVE; + function sanitizeAttributes(attributes) { + const out = {}; + if (typeof attributes !== "object" || attributes == null) { + return out; } - }; - exports.LowMemoryTemporalitySelector = LowMemoryTemporalitySelector; - function chooseTemporalitySelectorFromEnvironment() { - const configuredTemporality = ((0, core_1.getStringFromEnv)("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE") ?? "cumulative").toLowerCase(); - if (configuredTemporality === "cumulative") { - return exports.CumulativeTemporalitySelector; + for (const key in attributes) { + if (!Object.prototype.hasOwnProperty.call(attributes, key)) { + continue; + } + if (!isAttributeKey(key)) { + api_1.diag.warn(`Invalid attribute key: ${key}`); + continue; + } + const val = attributes[key]; + if (!isAttributeValue(val)) { + api_1.diag.warn(`Invalid attribute value set for key: ${key}`); + continue; + } + if (Array.isArray(val)) { + out[key] = val.slice(); + } else { + out[key] = val; + } } - if (configuredTemporality === "delta") { - return exports.DeltaTemporalitySelector; + return out; + } + exports.sanitizeAttributes = sanitizeAttributes; + function isAttributeKey(key) { + return typeof key === "string" && key !== ""; + } + exports.isAttributeKey = isAttributeKey; + function isAttributeValue(val) { + if (val == null) { + return true; } - if (configuredTemporality === "lowmemory") { - return exports.LowMemoryTemporalitySelector; + if (Array.isArray(val)) { + return isHomogeneousAttributeValueArray(val); } - api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`); - return exports.CumulativeTemporalitySelector; + return isValidPrimitiveAttributeValueType(typeof val); } - function chooseTemporalitySelector(temporalityPreference) { - if (temporalityPreference != null) { - if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.DELTA) { - return exports.DeltaTemporalitySelector; - } else if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.LOWMEMORY) { - return exports.LowMemoryTemporalitySelector; + exports.isAttributeValue = isAttributeValue; + function isHomogeneousAttributeValueArray(arr) { + let type; + for (const element of arr) { + if (element == null) + continue; + const elementType = typeof element; + if (elementType === type) { + continue; } - return exports.CumulativeTemporalitySelector; + if (!type) { + if (isValidPrimitiveAttributeValueType(elementType)) { + type = elementType; + continue; + } + return false; + } + return false; } - return chooseTemporalitySelectorFromEnvironment(); - } - var DEFAULT_AGGREGATION = Object.freeze({ - type: sdk_metrics_1.AggregationType.DEFAULT - }); - function chooseAggregationSelector(config) { - return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION); + return true; } - - class OTLPMetricExporterBase extends otlp_exporter_base_1.OTLPExporterBase { - _aggregationTemporalitySelector; - _aggregationSelector; - constructor(delegate, config) { - super(delegate); - this._aggregationSelector = chooseAggregationSelector(config); - this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference); - } - selectAggregation(instrumentType) { - return this._aggregationSelector(instrumentType); - } - selectAggregationTemporality(instrumentType) { - return this._aggregationTemporalitySelector(instrumentType); + function isValidPrimitiveAttributeValueType(valType) { + switch (valType) { + case "number": + case "boolean": + case "string": + return true; } + return false; } - exports.OTLPMetricExporterBase = OTLPMetricExporterBase; }); -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/node/OTLPMetricExporter.js -var require_OTLPMetricExporter = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.js +var require_logging_error_handler2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.OTLPMetricExporter = undefined; - var OTLPMetricExporterBase_1 = require_OTLPMetricExporterBase(); - var otlp_transformer_1 = require_src8(); - var node_http_1 = require_index_node_http(); - - class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase { - constructor(config) { - super((0, node_http_1.createOtlpHttpExportDelegate)((0, node_http_1.convertLegacyHttpOptions)(config ?? {}, "METRICS", "v1/metrics", { - "Content-Type": "application/json" - }), otlp_transformer_1.JsonMetricsSerializer), config); + exports.loggingErrorHandler = undefined; + var api_1 = require_src(); + function loggingErrorHandler() { + return (ex) => { + api_1.diag.error(stringifyException(ex)); + }; + } + exports.loggingErrorHandler = loggingErrorHandler; + function stringifyException(ex) { + if (typeof ex === "string") { + return ex; + } else { + return JSON.stringify(flattenException(ex)); } } - exports.OTLPMetricExporter = OTLPMetricExporter; + function flattenException(ex) { + const result = {}; + let current = ex; + while (current !== null) { + Object.getOwnPropertyNames(current).forEach((propertyName) => { + if (result[propertyName]) + return; + const value = current[propertyName]; + if (value) { + result[propertyName] = String(value); + } + }); + current = Object.getPrototypeOf(current); + } + return result; + } }); -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/node/index.js -var require_node12 = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/global-error-handler.js +var require_global_error_handler2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.OTLPMetricExporter = undefined; - var OTLPMetricExporter_1 = require_OTLPMetricExporter(); - Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { - return OTLPMetricExporter_1.OTLPMetricExporter; - } }); + exports.globalErrorHandler = exports.setGlobalErrorHandler = undefined; + var logging_error_handler_1 = require_logging_error_handler2(); + var delegateHandler = (0, logging_error_handler_1.loggingErrorHandler)(); + function setGlobalErrorHandler(handler) { + delegateHandler = handler; + } + exports.setGlobalErrorHandler = setGlobalErrorHandler; + function globalErrorHandler(ex) { + try { + delegateHandler(ex); + } catch {} + } + exports.globalErrorHandler = globalErrorHandler; }); -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/index.js -var require_platform11 = __commonJS((exports) => { +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/environment.js +var require_environment3 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); - exports.OTLPMetricExporter = undefined; - var node_1 = require_node12(); - Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { - return node_1.OTLPMetricExporter; - } }); -}); - -// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/index.js + exports.getStringListFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = exports.getNumberFromEnv = undefined; + var api_1 = require_src(); + var util_1 = __require("util"); + function getNumberFromEnv(key) { + const raw = process.env[key]; + if (raw == null || raw.trim() === "") { + return; + } + const value = Number(raw); + if (isNaN(value)) { + api_1.diag.warn(`Unknown value ${(0, util_1.inspect)(raw)} for ${key}, expected a number, using defaults`); + return; + } + return value; + } + exports.getNumberFromEnv = getNumberFromEnv; + function getStringFromEnv(key) { + const raw = process.env[key]; + if (raw == null || raw.trim() === "") { + return; + } + return raw; + } + exports.getStringFromEnv = getStringFromEnv; + function getBooleanFromEnv(key) { + const raw = process.env[key]?.trim().toLowerCase(); + if (raw == null || raw === "") { + return false; + } + if (raw === "true") { + return true; + } else if (raw === "false") { + return false; + } else { + api_1.diag.warn(`Unknown value ${(0, util_1.inspect)(raw)} for ${key}, expected 'true' or 'false', falling back to 'false' (default)`); + return false; + } + } + exports.getBooleanFromEnv = getBooleanFromEnv; + function getStringListFromEnv(key) { + return getStringFromEnv(key)?.split(",").map((v2) => v2.trim()).filter((s4) => s4 !== ""); + } + exports.getStringListFromEnv = getStringListFromEnv; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/globalThis.js +var require_globalThis2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports._globalThis = undefined; + exports._globalThis = globalThis; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/version.js +var require_version9 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.VERSION = undefined; + exports.VERSION = "2.9.0"; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/semconv.js +var require_semconv7 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ATTR_PROCESS_RUNTIME_NAME = undefined; + exports.ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name"; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/sdk-info.js +var require_sdk_info2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SDK_INFO = undefined; + var version_1 = require_version9(); + var semantic_conventions_1 = require_src2(); + var semconv_1 = require_semconv7(); + exports.SDK_INFO = { + [semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME]: "opentelemetry", + [semconv_1.ATTR_PROCESS_RUNTIME_NAME]: "node", + [semantic_conventions_1.ATTR_TELEMETRY_SDK_LANGUAGE]: semantic_conventions_1.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS, + [semantic_conventions_1.ATTR_TELEMETRY_SDK_VERSION]: version_1.VERSION + }; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/node/index.js +var require_node12 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.otperformance = exports.SDK_INFO = exports._globalThis = exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = undefined; + var environment_1 = require_environment3(); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return environment_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return environment_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return environment_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return environment_1.getStringListFromEnv; + } }); + var globalThis_1 = require_globalThis2(); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return globalThis_1._globalThis; + } }); + var sdk_info_1 = require_sdk_info2(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return sdk_info_1.SDK_INFO; + } }); + exports.otperformance = performance; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/platform/index.js +var require_platform11 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getStringFromEnv = exports.getBooleanFromEnv = exports.otperformance = exports._globalThis = exports.SDK_INFO = undefined; + var node_1 = require_node12(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return node_1.SDK_INFO; + } }); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return node_1._globalThis; + } }); + Object.defineProperty(exports, "otperformance", { enumerable: true, get: function() { + return node_1.otperformance; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return node_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return node_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return node_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return node_1.getStringListFromEnv; + } }); +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/time.js +var require_time2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.addHrTimes = exports.isTimeInput = exports.isTimeInputHrTime = exports.hrTimeToSeconds = exports.hrTimeToMilliseconds = exports.hrTimeToMicroseconds = exports.hrTimeToNanoseconds = exports.hrTimeToTimeStamp = exports.hrTimeDuration = exports.timeInputToHrTime = exports.hrTime = exports.getTimeOrigin = exports.millisToHrTime = undefined; + var platform_1 = require_platform11(); + var NANOSECOND_DIGITS = 9; + var NANOSECOND_DIGITS_IN_MILLIS = 6; + var MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS); + var SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS); + function millisToHrTime(epochMillis) { + const epochSeconds = epochMillis / 1000; + const seconds = Math.trunc(epochSeconds); + const nanos = Math.round(epochMillis % 1000 * MILLISECONDS_TO_NANOSECONDS); + return [seconds, nanos]; + } + exports.millisToHrTime = millisToHrTime; + function getTimeOrigin() { + return platform_1.otperformance.timeOrigin; + } + exports.getTimeOrigin = getTimeOrigin; + function hrTime(performanceNow) { + const timeOrigin = millisToHrTime(platform_1.otperformance.timeOrigin); + const now = millisToHrTime(typeof performanceNow === "number" ? performanceNow : platform_1.otperformance.now()); + return addHrTimes(timeOrigin, now); + } + exports.hrTime = hrTime; + function timeInputToHrTime(time) { + if (isTimeInputHrTime(time)) { + return time; + } else if (typeof time === "number") { + if (time < platform_1.otperformance.timeOrigin / 2) { + return hrTime(time); + } else { + return millisToHrTime(time); + } + } else if (time instanceof Date) { + return millisToHrTime(time.getTime()); + } else { + throw TypeError("Invalid input type"); + } + } + exports.timeInputToHrTime = timeInputToHrTime; + function hrTimeDuration(startTime, endTime) { + let seconds = endTime[0] - startTime[0]; + let nanos = endTime[1] - startTime[1]; + if (nanos < 0) { + seconds -= 1; + nanos += SECOND_TO_NANOSECONDS; + } + return [seconds, nanos]; + } + exports.hrTimeDuration = hrTimeDuration; + function hrTimeToTimeStamp(time) { + const precision = NANOSECOND_DIGITS; + const tmp = `${"0".repeat(precision)}${time[1]}Z`; + const nanoString = tmp.substring(tmp.length - precision - 1); + const date = new Date(time[0] * 1000).toISOString(); + return date.replace("000Z", nanoString); + } + exports.hrTimeToTimeStamp = hrTimeToTimeStamp; + function hrTimeToNanoseconds(time) { + return time[0] * SECOND_TO_NANOSECONDS + time[1]; + } + exports.hrTimeToNanoseconds = hrTimeToNanoseconds; + function hrTimeToMicroseconds(time) { + return time[0] * 1e6 + time[1] / 1000; + } + exports.hrTimeToMicroseconds = hrTimeToMicroseconds; + function hrTimeToMilliseconds(time) { + return time[0] * 1000 + time[1] / 1e6; + } + exports.hrTimeToMilliseconds = hrTimeToMilliseconds; + function hrTimeToSeconds(time) { + return time[0] + time[1] / SECOND_TO_NANOSECONDS; + } + exports.hrTimeToSeconds = hrTimeToSeconds; + function isTimeInputHrTime(value) { + return Array.isArray(value) && value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number"; + } + exports.isTimeInputHrTime = isTimeInputHrTime; + function isTimeInput(value) { + return isTimeInputHrTime(value) || typeof value === "number" || value instanceof Date; + } + exports.isTimeInput = isTimeInput; + function addHrTimes(time1, time2) { + const out = [time1[0] + time2[0], time1[1] + time2[1]]; + if (out[1] >= SECOND_TO_NANOSECONDS) { + out[1] -= SECOND_TO_NANOSECONDS; + out[0] += 1; + } + return out; + } + exports.addHrTimes = addHrTimes; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/common/timer-util.js +var require_timer_util2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.unrefTimer = undefined; + function unrefTimer(timer) { + if (typeof timer !== "number") { + timer.unref(); + } + } + exports.unrefTimer = unrefTimer; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/ExportResult.js +var require_ExportResult2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExportResultCode = undefined; + var ExportResultCode; + (function(ExportResultCode2) { + ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS"; + ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED"; + })(ExportResultCode = exports.ExportResultCode || (exports.ExportResultCode = {})); +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/propagation/composite.js +var require_composite2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CompositePropagator = undefined; + var api_1 = require_src(); + + class CompositePropagator { + _propagators; + _fields; + constructor(config = {}) { + this._propagators = config.propagators ?? []; + const fields = new Set; + for (const propagator of this._propagators) { + const propagatorFields = typeof propagator.fields === "function" ? propagator.fields() : []; + for (const field of propagatorFields) { + fields.add(field); + } + } + this._fields = Array.from(fields); + } + inject(context2, carrier, setter) { + for (const propagator of this._propagators) { + try { + propagator.inject(context2, carrier, setter); + } catch (err) { + api_1.diag.warn(`Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`); + } + } + } + extract(context2, carrier, getter) { + return this._propagators.reduce((ctx, propagator) => { + try { + return propagator.extract(ctx, carrier, getter); + } catch (err) { + api_1.diag.warn(`Failed to extract with ${propagator.constructor.name}. Err: ${err.message}`); + } + return ctx; + }, context2); + } + fields() { + return this._fields.slice(); + } + } + exports.CompositePropagator = CompositePropagator; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/internal/validators.js +var require_validators2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.validateValue = exports.validateKey = undefined; + var VALID_KEY_CHAR_RANGE = "[_0-9a-z-*/]"; + var VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`; + var VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`; + var VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`); + var VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/; + var INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/; + function validateKey(key) { + return VALID_KEY_REGEX.test(key); + } + exports.validateKey = validateKey; + function validateValue(value) { + return VALID_VALUE_BASE_REGEX.test(value) && !INVALID_VALUE_COMMA_EQUAL_REGEX.test(value); + } + exports.validateValue = validateValue; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/TraceState.js +var require_TraceState2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TraceState = undefined; + var validators_1 = require_validators2(); + var MAX_TRACE_STATE_ITEMS = 32; + var MAX_TRACE_STATE_LEN = 512; + var LIST_MEMBERS_SEPARATOR = ","; + var LIST_MEMBER_KEY_VALUE_SPLITTER = "="; + + class TraceState { + _length; + _rawTraceState; + _internalState; + constructor(rawTraceState) { + this._rawTraceState = typeof rawTraceState === "string" ? rawTraceState : ""; + this._length = this._rawTraceState.length; + } + set(key, value) { + if (!(0, validators_1.validateKey)(key) || !(0, validators_1.validateValue)(value)) { + return this; + } + const currState = this._getState(); + const currValue = currState.get(key); + let newLength = this._length; + if (typeof currValue === "string") { + newLength += value.length - currValue.length; + } else { + newLength += key.length + value.length + (currState.size > 0 ? 2 : 1); + } + if (newLength > MAX_TRACE_STATE_LEN) { + return this; + } + const newState = new Map(currState); + newState.delete(key); + newState.set(key, value); + return this._fromState(newState, newLength); + } + unset(key) { + const currState = this._getState(); + const currValue = currState.get(key); + if (typeof currValue !== "string") { + return this; + } + let newLength = this._length - (key.length + currValue.length + 1); + if (currState.size > 1) { + newLength = newLength - 1; + } + const newState = new Map(currState); + newState.delete(key); + return this._fromState(newState, newLength); + } + get(key) { + const currState = this._getState(); + return currState.get(key); + } + serialize() { + let serialized = ""; + let index = 0; + for (const entry of this._getState()) { + if (index > 0) { + serialized = LIST_MEMBERS_SEPARATOR + serialized; + } + serialized = `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized; + index++; + } + return serialized; + } + _getState() { + if (this._internalState) { + return this._internalState; + } + const vendorMembers = this._rawTraceState.split(LIST_MEMBERS_SEPARATOR); + const vendorEntries = new Map; + let currentLength = 0; + for (const member of vendorMembers) { + const m3 = member.trim(); + const idx = m3.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER); + if (idx === -1) { + continue; + } + const key = m3.slice(0, idx); + const value = m3.slice(idx + 1); + if (!(0, validators_1.validateKey)(key) || !(0, validators_1.validateValue)(value)) { + continue; + } + const futureLength = currentLength + m3.length + (vendorEntries.size > 0 ? 1 : 0); + if (futureLength > MAX_TRACE_STATE_LEN) { + continue; + } + vendorEntries.set(key, value); + currentLength = futureLength; + if (vendorEntries.size >= MAX_TRACE_STATE_ITEMS) { + break; + } + } + this._length = currentLength; + this._internalState = new Map(Array.from(vendorEntries.entries()).reverse()); + return this._internalState; + } + _fromState(state, length) { + const traceState = Object.create(TraceState.prototype); + traceState._internalState = state; + traceState._length = length; + return traceState; + } + } + exports.TraceState = TraceState; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.js +var require_W3CTraceContextPropagator2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.W3CTraceContextPropagator = exports.parseTraceParent = exports.TRACE_STATE_HEADER = exports.TRACE_PARENT_HEADER = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + var TraceState_1 = require_TraceState2(); + exports.TRACE_PARENT_HEADER = "traceparent"; + exports.TRACE_STATE_HEADER = "tracestate"; + var VERSION = "00"; + var VERSION_PART = "(?!ff)[\\da-f]{2}"; + var TRACE_ID_PART = "(?![0]{32})[\\da-f]{32}"; + var PARENT_ID_PART = "(?![0]{16})[\\da-f]{16}"; + var FLAGS_PART = "[\\da-f]{2}"; + var TRACE_PARENT_REGEX = new RegExp(`^\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\s?$`); + function parseTraceParent(traceParent) { + const match = TRACE_PARENT_REGEX.exec(traceParent); + if (!match) + return null; + if (match[1] === "00" && match[5]) + return null; + return { + traceId: match[2], + spanId: match[3], + traceFlags: parseInt(match[4], 16) + }; + } + exports.parseTraceParent = parseTraceParent; + + class W3CTraceContextPropagator { + inject(context2, carrier, setter) { + const spanContext = api_1.trace.getSpanContext(context2); + if (!spanContext || (0, suppress_tracing_1.isTracingSuppressed)(context2) || !(0, api_1.isSpanContextValid)(spanContext)) + return; + const traceParent = `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-0${Number(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`; + setter.set(carrier, exports.TRACE_PARENT_HEADER, traceParent); + if (spanContext.traceState) { + setter.set(carrier, exports.TRACE_STATE_HEADER, spanContext.traceState.serialize()); + } + } + extract(context2, carrier, getter) { + const traceParentHeader = getter.get(carrier, exports.TRACE_PARENT_HEADER); + if (!traceParentHeader) + return context2; + const traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader; + if (typeof traceParent !== "string") + return context2; + const spanContext = parseTraceParent(traceParent); + if (!spanContext) + return context2; + spanContext.isRemote = true; + const traceStateHeader = getter.get(carrier, exports.TRACE_STATE_HEADER); + if (traceStateHeader) { + const state = Array.isArray(traceStateHeader) ? traceStateHeader.join(",") : traceStateHeader; + spanContext.traceState = new TraceState_1.TraceState(typeof state === "string" ? state : undefined); + } + return api_1.trace.setSpanContext(context2, spanContext); + } + fields() { + return [exports.TRACE_PARENT_HEADER, exports.TRACE_STATE_HEADER]; + } + } + exports.W3CTraceContextPropagator = W3CTraceContextPropagator; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.js +var require_rpc_metadata2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getRPCMetadata = exports.deleteRPCMetadata = exports.setRPCMetadata = exports.RPCType = undefined; + var api_1 = require_src(); + var RPC_METADATA_KEY = (0, api_1.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"); + var RPCType; + (function(RPCType2) { + RPCType2["HTTP"] = "http"; + })(RPCType = exports.RPCType || (exports.RPCType = {})); + function setRPCMetadata(context2, meta) { + return context2.setValue(RPC_METADATA_KEY, meta); + } + exports.setRPCMetadata = setRPCMetadata; + function deleteRPCMetadata(context2) { + return context2.deleteValue(RPC_METADATA_KEY); + } + exports.deleteRPCMetadata = deleteRPCMetadata; + function getRPCMetadata(context2) { + return context2.getValue(RPC_METADATA_KEY); + } + exports.getRPCMetadata = getRPCMetadata; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/lodash.merge.js +var require_lodash_merge2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isPlainObject = undefined; + var objectTag = "[object Object]"; + var nullTag = "[object Null]"; + var undefinedTag = "[object Undefined]"; + var funcProto = Function.prototype; + var funcToString = funcProto.toString; + var objectCtorString = funcToString.call(Object); + var getPrototypeOf = Object.getPrototypeOf; + var objectProto = Object.prototype; + var hasOwnProperty = objectProto.hasOwnProperty; + var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + var nativeObjectToString = objectProto.toString; + function isPlainObject3(value) { + if (!isObjectLike(value) || baseGetTag(value) !== objectTag) { + return false; + } + const proto = getPrototypeOf(value); + if (proto === null) { + return true; + } + const Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) === objectCtorString; + } + exports.isPlainObject = isPlainObject3; + function isObjectLike(value) { + return value != null && typeof value == "object"; + } + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString3(value); + } + function getRawTag(value) { + const isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; + let unmasked = false; + try { + value[symToStringTag] = undefined; + unmasked = true; + } catch {} + const result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + function objectToString3(value) { + return nativeObjectToString.call(value); + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/merge.js +var require_merge2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.merge = undefined; + var lodash_merge_1 = require_lodash_merge2(); + var MAX_LEVEL = 20; + function merge(...args) { + let result = args.shift(); + const objects = new WeakMap; + while (args.length > 0) { + result = mergeTwoObjects(result, args.shift(), 0, objects); + } + return result; + } + exports.merge = merge; + function takeValue(value) { + if (isArray(value)) { + return value.slice(); + } + return value; + } + function mergeTwoObjects(one, two, level = 0, objects) { + let result; + if (level > MAX_LEVEL) { + return; + } + level++; + if (isPrimitive(one) || isPrimitive(two) || isFunction(two)) { + result = takeValue(two); + } else if (isArray(one)) { + result = one.slice(); + if (isArray(two)) { + for (let i3 = 0, j2 = two.length;i3 < j2; i3++) { + result.push(takeValue(two[i3])); + } + } else if (isObject2(two)) { + const keys = Object.keys(two); + for (let i3 = 0, j2 = keys.length;i3 < j2; i3++) { + const key = keys[i3]; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + continue; + } + result[key] = takeValue(two[key]); + } + } + } else if (isObject2(one)) { + if (isObject2(two)) { + if (!shouldMerge(one, two)) { + return two; + } + result = Object.assign({}, one); + const keys = Object.keys(two); + for (let i3 = 0, j2 = keys.length;i3 < j2; i3++) { + const key = keys[i3]; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + continue; + } + const twoValue = two[key]; + if (isPrimitive(twoValue)) { + if (typeof twoValue === "undefined") { + delete result[key]; + } else { + result[key] = twoValue; + } + } else { + const obj1 = result[key]; + const obj2 = twoValue; + if (wasObjectReferenced(one, key, objects) || wasObjectReferenced(two, key, objects)) { + delete result[key]; + } else { + if (isObject2(obj1) && isObject2(obj2)) { + const arr1 = objects.get(obj1) || []; + const arr2 = objects.get(obj2) || []; + arr1.push({ obj: one, key }); + arr2.push({ obj: two, key }); + objects.set(obj1, arr1); + objects.set(obj2, arr2); + } + result[key] = mergeTwoObjects(result[key], twoValue, level, objects); + } + } + } + } else { + result = two; + } + } + return result; + } + function wasObjectReferenced(obj, key, objects) { + const arr = objects.get(obj[key]) || []; + for (let i3 = 0, j2 = arr.length;i3 < j2; i3++) { + const info = arr[i3]; + if (info.key === key && info.obj === obj) { + return true; + } + } + return false; + } + function isArray(value) { + return Array.isArray(value); + } + function isFunction(value) { + return typeof value === "function"; + } + function isObject2(value) { + return !isPrimitive(value) && !isArray(value) && !isFunction(value) && typeof value === "object"; + } + function isPrimitive(value) { + return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "undefined" || value instanceof Date || value instanceof RegExp || value === null; + } + function shouldMerge(one, two) { + if (!(0, lodash_merge_1.isPlainObject)(one) || !(0, lodash_merge_1.isPlainObject)(two)) { + return false; + } + return true; + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/timeout.js +var require_timeout2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.callWithTimeout = exports.TimeoutError = undefined; + + class TimeoutError extends Error { + constructor(message) { + super(message); + Object.setPrototypeOf(this, TimeoutError.prototype); + } + } + exports.TimeoutError = TimeoutError; + function callWithTimeout(promise, timeout) { + let timeoutHandle; + const timeoutPromise = new Promise(function timeoutFunction(_resolve, reject) { + timeoutHandle = setTimeout(function timeoutHandler() { + reject(new TimeoutError("Operation timed out.")); + }, timeout); + }); + return Promise.race([promise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle); + return result; + }, (reason) => { + clearTimeout(timeoutHandle); + throw reason; + }); + } + exports.callWithTimeout = callWithTimeout; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/url.js +var require_url2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isUrlIgnored = exports.urlMatches = undefined; + function urlMatches(url, urlToMatch) { + if (typeof urlToMatch === "string") { + return url === urlToMatch; + } else { + return !!url.match(urlToMatch); + } + } + exports.urlMatches = urlMatches; + function isUrlIgnored(url, ignoredUrls) { + if (!ignoredUrls) { + return false; + } + for (const ignoreUrl of ignoredUrls) { + if (urlMatches(url, ignoreUrl)) { + return true; + } + } + return false; + } + exports.isUrlIgnored = isUrlIgnored; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/promise.js +var require_promise2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Deferred = undefined; + + class Deferred { + _promise; + _resolve; + _reject; + constructor() { + this._promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + }); + } + get promise() { + return this._promise; + } + resolve(val) { + this._resolve(val); + } + reject(err) { + this._reject(err); + } + } + exports.Deferred = Deferred; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/callback.js +var require_callback2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.BindOnceFuture = undefined; + var promise_1 = require_promise2(); + + class BindOnceFuture { + _isCalled = false; + _deferred = new promise_1.Deferred; + _callback; + _that; + constructor(callback, that) { + this._callback = callback; + this._that = that; + } + get isCalled() { + return this._isCalled; + } + get promise() { + return this._deferred.promise; + } + call(...args) { + if (!this._isCalled) { + this._isCalled = true; + try { + Promise.resolve(this._callback.call(this._that, ...args)).then((val) => this._deferred.resolve(val), (err) => this._deferred.reject(err)); + } catch (err) { + this._deferred.reject(err); + } + } + return this._deferred.promise; + } + } + exports.BindOnceFuture = BindOnceFuture; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/utils/configuration.js +var require_configuration2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.diagLogLevelFromString = undefined; + var api_1 = require_src(); + var logLevelMap = { + ALL: api_1.DiagLogLevel.ALL, + VERBOSE: api_1.DiagLogLevel.VERBOSE, + DEBUG: api_1.DiagLogLevel.DEBUG, + INFO: api_1.DiagLogLevel.INFO, + WARN: api_1.DiagLogLevel.WARN, + ERROR: api_1.DiagLogLevel.ERROR, + NONE: api_1.DiagLogLevel.NONE + }; + function diagLogLevelFromString(value) { + if (value == null) { + return; + } + const resolvedLogLevel = logLevelMap[value.toUpperCase()]; + if (resolvedLogLevel == null) { + api_1.diag.warn(`Unknown log level "${value}", expected one of ${Object.keys(logLevelMap)}, using default`); + return api_1.DiagLogLevel.INFO; + } + return resolvedLogLevel; + } + exports.diagLogLevelFromString = diagLogLevelFromString; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/internal/exporter.js +var require_exporter2 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports._export = undefined; + var api_1 = require_src(); + var suppress_tracing_1 = require_suppress_tracing2(); + function _export(exporter, arg) { + return new Promise((resolve) => { + api_1.context.with((0, suppress_tracing_1.suppressTracing)(api_1.context.active()), () => { + exporter.export(arg, resolve); + }); + }); + } + exports._export = _export; +}); + +// node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core/build/src/index.js +var require_src28 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.diagLogLevelFromString = exports.BindOnceFuture = exports.urlMatches = exports.isUrlIgnored = exports.callWithTimeout = exports.TimeoutError = exports.merge = exports.TraceState = exports.unsuppressTracing = exports.suppressTracing = exports.isTracingSuppressed = exports.setRPCMetadata = exports.getRPCMetadata = exports.deleteRPCMetadata = exports.RPCType = exports.parseTraceParent = exports.W3CTraceContextPropagator = exports.TRACE_STATE_HEADER = exports.TRACE_PARENT_HEADER = exports.CompositePropagator = exports.otperformance = exports.getStringListFromEnv = exports.getNumberFromEnv = exports.getBooleanFromEnv = exports.getStringFromEnv = exports._globalThis = exports.SDK_INFO = exports.parseKeyPairsIntoRecord = exports.ExportResultCode = exports.unrefTimer = exports.timeInputToHrTime = exports.millisToHrTime = exports.isTimeInputHrTime = exports.isTimeInput = exports.hrTimeToTimeStamp = exports.hrTimeToSeconds = exports.hrTimeToNanoseconds = exports.hrTimeToMilliseconds = exports.hrTimeToMicroseconds = exports.hrTimeDuration = exports.hrTime = exports.getTimeOrigin = exports.addHrTimes = exports.loggingErrorHandler = exports.setGlobalErrorHandler = exports.globalErrorHandler = exports.sanitizeAttributes = exports.isAttributeValue = exports.AnchoredClock = exports.W3CBaggagePropagator = undefined; + exports.internal = undefined; + var W3CBaggagePropagator_1 = require_W3CBaggagePropagator2(); + Object.defineProperty(exports, "W3CBaggagePropagator", { enumerable: true, get: function() { + return W3CBaggagePropagator_1.W3CBaggagePropagator; + } }); + var anchored_clock_1 = require_anchored_clock2(); + Object.defineProperty(exports, "AnchoredClock", { enumerable: true, get: function() { + return anchored_clock_1.AnchoredClock; + } }); + var attributes_1 = require_attributes2(); + Object.defineProperty(exports, "isAttributeValue", { enumerable: true, get: function() { + return attributes_1.isAttributeValue; + } }); + Object.defineProperty(exports, "sanitizeAttributes", { enumerable: true, get: function() { + return attributes_1.sanitizeAttributes; + } }); + var global_error_handler_1 = require_global_error_handler2(); + Object.defineProperty(exports, "globalErrorHandler", { enumerable: true, get: function() { + return global_error_handler_1.globalErrorHandler; + } }); + Object.defineProperty(exports, "setGlobalErrorHandler", { enumerable: true, get: function() { + return global_error_handler_1.setGlobalErrorHandler; + } }); + var logging_error_handler_1 = require_logging_error_handler2(); + Object.defineProperty(exports, "loggingErrorHandler", { enumerable: true, get: function() { + return logging_error_handler_1.loggingErrorHandler; + } }); + var time_1 = require_time2(); + Object.defineProperty(exports, "addHrTimes", { enumerable: true, get: function() { + return time_1.addHrTimes; + } }); + Object.defineProperty(exports, "getTimeOrigin", { enumerable: true, get: function() { + return time_1.getTimeOrigin; + } }); + Object.defineProperty(exports, "hrTime", { enumerable: true, get: function() { + return time_1.hrTime; + } }); + Object.defineProperty(exports, "hrTimeDuration", { enumerable: true, get: function() { + return time_1.hrTimeDuration; + } }); + Object.defineProperty(exports, "hrTimeToMicroseconds", { enumerable: true, get: function() { + return time_1.hrTimeToMicroseconds; + } }); + Object.defineProperty(exports, "hrTimeToMilliseconds", { enumerable: true, get: function() { + return time_1.hrTimeToMilliseconds; + } }); + Object.defineProperty(exports, "hrTimeToNanoseconds", { enumerable: true, get: function() { + return time_1.hrTimeToNanoseconds; + } }); + Object.defineProperty(exports, "hrTimeToSeconds", { enumerable: true, get: function() { + return time_1.hrTimeToSeconds; + } }); + Object.defineProperty(exports, "hrTimeToTimeStamp", { enumerable: true, get: function() { + return time_1.hrTimeToTimeStamp; + } }); + Object.defineProperty(exports, "isTimeInput", { enumerable: true, get: function() { + return time_1.isTimeInput; + } }); + Object.defineProperty(exports, "isTimeInputHrTime", { enumerable: true, get: function() { + return time_1.isTimeInputHrTime; + } }); + Object.defineProperty(exports, "millisToHrTime", { enumerable: true, get: function() { + return time_1.millisToHrTime; + } }); + Object.defineProperty(exports, "timeInputToHrTime", { enumerable: true, get: function() { + return time_1.timeInputToHrTime; + } }); + var timer_util_1 = require_timer_util2(); + Object.defineProperty(exports, "unrefTimer", { enumerable: true, get: function() { + return timer_util_1.unrefTimer; + } }); + var ExportResult_1 = require_ExportResult2(); + Object.defineProperty(exports, "ExportResultCode", { enumerable: true, get: function() { + return ExportResult_1.ExportResultCode; + } }); + var utils_1 = require_utils14(); + Object.defineProperty(exports, "parseKeyPairsIntoRecord", { enumerable: true, get: function() { + return utils_1.parseKeyPairsIntoRecord; + } }); + var platform_1 = require_platform11(); + Object.defineProperty(exports, "SDK_INFO", { enumerable: true, get: function() { + return platform_1.SDK_INFO; + } }); + Object.defineProperty(exports, "_globalThis", { enumerable: true, get: function() { + return platform_1._globalThis; + } }); + Object.defineProperty(exports, "getStringFromEnv", { enumerable: true, get: function() { + return platform_1.getStringFromEnv; + } }); + Object.defineProperty(exports, "getBooleanFromEnv", { enumerable: true, get: function() { + return platform_1.getBooleanFromEnv; + } }); + Object.defineProperty(exports, "getNumberFromEnv", { enumerable: true, get: function() { + return platform_1.getNumberFromEnv; + } }); + Object.defineProperty(exports, "getStringListFromEnv", { enumerable: true, get: function() { + return platform_1.getStringListFromEnv; + } }); + Object.defineProperty(exports, "otperformance", { enumerable: true, get: function() { + return platform_1.otperformance; + } }); + var composite_1 = require_composite2(); + Object.defineProperty(exports, "CompositePropagator", { enumerable: true, get: function() { + return composite_1.CompositePropagator; + } }); + var W3CTraceContextPropagator_1 = require_W3CTraceContextPropagator2(); + Object.defineProperty(exports, "TRACE_PARENT_HEADER", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.TRACE_PARENT_HEADER; + } }); + Object.defineProperty(exports, "TRACE_STATE_HEADER", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.TRACE_STATE_HEADER; + } }); + Object.defineProperty(exports, "W3CTraceContextPropagator", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.W3CTraceContextPropagator; + } }); + Object.defineProperty(exports, "parseTraceParent", { enumerable: true, get: function() { + return W3CTraceContextPropagator_1.parseTraceParent; + } }); + var rpc_metadata_1 = require_rpc_metadata2(); + Object.defineProperty(exports, "RPCType", { enumerable: true, get: function() { + return rpc_metadata_1.RPCType; + } }); + Object.defineProperty(exports, "deleteRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.deleteRPCMetadata; + } }); + Object.defineProperty(exports, "getRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.getRPCMetadata; + } }); + Object.defineProperty(exports, "setRPCMetadata", { enumerable: true, get: function() { + return rpc_metadata_1.setRPCMetadata; + } }); + var suppress_tracing_1 = require_suppress_tracing2(); + Object.defineProperty(exports, "isTracingSuppressed", { enumerable: true, get: function() { + return suppress_tracing_1.isTracingSuppressed; + } }); + Object.defineProperty(exports, "suppressTracing", { enumerable: true, get: function() { + return suppress_tracing_1.suppressTracing; + } }); + Object.defineProperty(exports, "unsuppressTracing", { enumerable: true, get: function() { + return suppress_tracing_1.unsuppressTracing; + } }); + var TraceState_1 = require_TraceState2(); + Object.defineProperty(exports, "TraceState", { enumerable: true, get: function() { + return TraceState_1.TraceState; + } }); + var merge_1 = require_merge2(); + Object.defineProperty(exports, "merge", { enumerable: true, get: function() { + return merge_1.merge; + } }); + var timeout_1 = require_timeout2(); + Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function() { + return timeout_1.TimeoutError; + } }); + Object.defineProperty(exports, "callWithTimeout", { enumerable: true, get: function() { + return timeout_1.callWithTimeout; + } }); + var url_1 = require_url2(); + Object.defineProperty(exports, "isUrlIgnored", { enumerable: true, get: function() { + return url_1.isUrlIgnored; + } }); + Object.defineProperty(exports, "urlMatches", { enumerable: true, get: function() { + return url_1.urlMatches; + } }); + var callback_1 = require_callback2(); + Object.defineProperty(exports, "BindOnceFuture", { enumerable: true, get: function() { + return callback_1.BindOnceFuture; + } }); + var configuration_1 = require_configuration2(); + Object.defineProperty(exports, "diagLogLevelFromString", { enumerable: true, get: function() { + return configuration_1.diagLogLevelFromString; + } }); + var exporter_1 = require_exporter2(); + exports.internal = { + _export: exporter_1._export + }; +}); + +// node_modules/@opentelemetry/propagator-jaeger/build/src/JaegerPropagator.js +var require_JaegerPropagator = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JaegerPropagator = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.UBER_TRACE_ID_HEADER = undefined; + var api_1 = require_src(); + var core_1 = require_src28(); + exports.UBER_TRACE_ID_HEADER = "uber-trace-id"; + exports.UBER_BAGGAGE_HEADER_PREFIX = "uberctx"; + + class JaegerPropagator { + _jaegerTraceHeader; + _jaegerBaggageHeaderPrefix; + constructor(config) { + if (typeof config === "string") { + this._jaegerTraceHeader = config; + this._jaegerBaggageHeaderPrefix = exports.UBER_BAGGAGE_HEADER_PREFIX; + } else { + this._jaegerTraceHeader = config?.customTraceHeader || exports.UBER_TRACE_ID_HEADER; + this._jaegerBaggageHeaderPrefix = config?.customBaggageHeaderPrefix || exports.UBER_BAGGAGE_HEADER_PREFIX; + } + } + inject(context2, carrier, setter) { + const spanContext = api_1.trace.getSpanContext(context2); + const baggage = api_1.propagation.getBaggage(context2); + if (spanContext && (0, core_1.isTracingSuppressed)(context2) === false) { + const traceFlags = `0${(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`; + setter.set(carrier, this._jaegerTraceHeader, `${spanContext.traceId}:${spanContext.spanId}:0:${traceFlags}`); + } + if (baggage) { + for (const [key, entry] of baggage.getAllEntries()) { + setter.set(carrier, `${this._jaegerBaggageHeaderPrefix}-${key}`, encodeURIComponent(entry.value)); + } + } + } + extract(context2, carrier, getter) { + const uberTraceIdHeader = getter.get(carrier, this._jaegerTraceHeader); + const uberTraceId = Array.isArray(uberTraceIdHeader) ? uberTraceIdHeader[0] : uberTraceIdHeader; + const baggageValues = getter.keys(carrier).filter((key) => key.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((key) => { + const value = getter.get(carrier, key); + return { + key: key.substring(this._jaegerBaggageHeaderPrefix.length + 1), + value: Array.isArray(value) ? value[0] : value + }; + }); + let newContext = context2; + if (typeof uberTraceId === "string") { + const spanContext = deserializeSpanContext(uberTraceId); + if (spanContext) { + newContext = api_1.trace.setSpanContext(newContext, spanContext); + } + } + if (baggageValues.length === 0) + return newContext; + let currentBaggage = api_1.propagation.getBaggage(context2) ?? api_1.propagation.createBaggage(); + for (const baggageEntry of baggageValues) { + if (baggageEntry.value === undefined) + continue; + let decodedValue; + try { + decodedValue = decodeURIComponent(baggageEntry.value); + } catch { + continue; + } + currentBaggage = currentBaggage.setEntry(baggageEntry.key, { + value: decodedValue + }); + } + newContext = api_1.propagation.setBaggage(newContext, currentBaggage); + return newContext; + } + fields() { + return [this._jaegerTraceHeader]; + } + } + exports.JaegerPropagator = JaegerPropagator; + var VALID_HEX_RE = /^[0-9a-f]{1,2}$/i; + function deserializeSpanContext(serializedString) { + let decoded; + try { + decoded = decodeURIComponent(serializedString); + } catch { + return null; + } + const headers = decoded.split(":"); + if (headers.length !== 4) { + return null; + } + const [_traceId, _spanId, , flags] = headers; + const traceId = _traceId.padStart(32, "0"); + const spanId = _spanId.padStart(16, "0"); + const traceFlags = VALID_HEX_RE.test(flags) ? parseInt(flags, 16) & 1 : 1; + return { traceId, spanId, isRemote: true, traceFlags }; + } +}); + +// node_modules/@opentelemetry/propagator-jaeger/build/src/index.js var require_src29 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.UBER_TRACE_ID_HEADER = exports.UBER_BAGGAGE_HEADER_PREFIX = exports.JaegerPropagator = undefined; + var JaegerPropagator_1 = require_JaegerPropagator(); + Object.defineProperty(exports, "JaegerPropagator", { enumerable: true, get: function() { + return JaegerPropagator_1.JaegerPropagator; + } }); + Object.defineProperty(exports, "UBER_BAGGAGE_HEADER_PREFIX", { enumerable: true, get: function() { + return JaegerPropagator_1.UBER_BAGGAGE_HEADER_PREFIX; + } }); + Object.defineProperty(exports, "UBER_TRACE_ID_HEADER", { enumerable: true, get: function() { + return JaegerPropagator_1.UBER_TRACE_ID_HEADER; + } }); +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/OTLPMetricExporterOptions.js +var require_OTLPMetricExporterOptions = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AggregationTemporalityPreference = undefined; + var AggregationTemporalityPreference; + (function(AggregationTemporalityPreference2) { + AggregationTemporalityPreference2[AggregationTemporalityPreference2["DELTA"] = 0] = "DELTA"; + AggregationTemporalityPreference2[AggregationTemporalityPreference2["CUMULATIVE"] = 1] = "CUMULATIVE"; + AggregationTemporalityPreference2[AggregationTemporalityPreference2["LOWMEMORY"] = 2] = "LOWMEMORY"; + })(AggregationTemporalityPreference = exports.AggregationTemporalityPreference || (exports.AggregationTemporalityPreference = {})); +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/OTLPMetricExporterBase.js +var require_OTLPMetricExporterBase = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = undefined; + var core_1 = require_src3(); + var sdk_metrics_1 = require_src7(); + var OTLPMetricExporterOptions_1 = require_OTLPMetricExporterOptions(); + var otlp_exporter_base_1 = require_src4(); + var api_1 = require_src(); + var CumulativeTemporalitySelector = () => sdk_metrics_1.AggregationTemporality.CUMULATIVE; + exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector; + var DeltaTemporalitySelector = (instrumentType) => { + switch (instrumentType) { + case sdk_metrics_1.InstrumentType.COUNTER: + case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER: + case sdk_metrics_1.InstrumentType.GAUGE: + case sdk_metrics_1.InstrumentType.HISTOGRAM: + case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE: + return sdk_metrics_1.AggregationTemporality.DELTA; + case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER: + case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: + return sdk_metrics_1.AggregationTemporality.CUMULATIVE; + } + }; + exports.DeltaTemporalitySelector = DeltaTemporalitySelector; + var LowMemoryTemporalitySelector = (instrumentType) => { + switch (instrumentType) { + case sdk_metrics_1.InstrumentType.COUNTER: + case sdk_metrics_1.InstrumentType.HISTOGRAM: + return sdk_metrics_1.AggregationTemporality.DELTA; + case sdk_metrics_1.InstrumentType.GAUGE: + case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER: + case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: + case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER: + case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE: + return sdk_metrics_1.AggregationTemporality.CUMULATIVE; + } + }; + exports.LowMemoryTemporalitySelector = LowMemoryTemporalitySelector; + function chooseTemporalitySelectorFromEnvironment() { + const configuredTemporality = ((0, core_1.getStringFromEnv)("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE") ?? "cumulative").toLowerCase(); + if (configuredTemporality === "cumulative") { + return exports.CumulativeTemporalitySelector; + } + if (configuredTemporality === "delta") { + return exports.DeltaTemporalitySelector; + } + if (configuredTemporality === "lowmemory") { + return exports.LowMemoryTemporalitySelector; + } + api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`); + return exports.CumulativeTemporalitySelector; + } + function chooseTemporalitySelector(temporalityPreference) { + if (temporalityPreference != null) { + if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.DELTA) { + return exports.DeltaTemporalitySelector; + } else if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.LOWMEMORY) { + return exports.LowMemoryTemporalitySelector; + } + return exports.CumulativeTemporalitySelector; + } + return chooseTemporalitySelectorFromEnvironment(); + } + var DEFAULT_AGGREGATION = Object.freeze({ + type: sdk_metrics_1.AggregationType.DEFAULT + }); + function chooseAggregationSelector(config) { + return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION); + } + + class OTLPMetricExporterBase extends otlp_exporter_base_1.OTLPExporterBase { + _aggregationTemporalitySelector; + _aggregationSelector; + constructor(delegate, config) { + super(delegate); + this._aggregationSelector = chooseAggregationSelector(config); + this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference); + } + selectAggregation(instrumentType) { + return this._aggregationSelector(instrumentType); + } + selectAggregationTemporality(instrumentType) { + return this._aggregationTemporalitySelector(instrumentType); + } + } + exports.OTLPMetricExporterBase = OTLPMetricExporterBase; +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/node/OTLPMetricExporter.js +var require_OTLPMetricExporter = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.OTLPMetricExporter = undefined; + var OTLPMetricExporterBase_1 = require_OTLPMetricExporterBase(); + var otlp_transformer_1 = require_src8(); + var node_http_1 = require_index_node_http(); + + class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase { + constructor(config) { + super((0, node_http_1.createOtlpHttpExportDelegate)((0, node_http_1.convertLegacyHttpOptions)(config ?? {}, "METRICS", "v1/metrics", { + "Content-Type": "application/json" + }), otlp_transformer_1.JsonMetricsSerializer), config); + } + } + exports.OTLPMetricExporter = OTLPMetricExporter; +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/node/index.js +var require_node13 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.OTLPMetricExporter = undefined; + var OTLPMetricExporter_1 = require_OTLPMetricExporter(); + Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { + return OTLPMetricExporter_1.OTLPMetricExporter; + } }); +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/platform/index.js +var require_platform12 = __commonJS((exports) => { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.OTLPMetricExporter = undefined; + var node_1 = require_node13(); + Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { + return node_1.OTLPMetricExporter; + } }); +}); + +// node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/index.js +var require_src30 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = exports.AggregationTemporalityPreference = exports.OTLPMetricExporter = undefined; - var platform_1 = require_platform11(); + var platform_1 = require_platform12(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return platform_1.OTLPMetricExporter; } }); @@ -79464,7 +80867,7 @@ var require_src29 = __commonJS((exports) => { var require_OTLPMetricExporter2 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var exporter_metrics_otlp_http_1 = require_src29(); + var exporter_metrics_otlp_http_1 = require_src30(); var otlp_grpc_exporter_base_1 = require_src20(); var otlp_transformer_1 = require_src8(); @@ -79477,7 +80880,7 @@ var require_OTLPMetricExporter2 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/index.js -var require_src30 = __commonJS((exports) => { +var require_src31 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; var OTLPMetricExporter_1 = require_OTLPMetricExporter2(); @@ -79490,7 +80893,7 @@ var require_src30 = __commonJS((exports) => { var require_OTLPMetricExporter3 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var exporter_metrics_otlp_http_1 = require_src29(); + var exporter_metrics_otlp_http_1 = require_src30(); var otlp_transformer_1 = require_src8(); var node_http_1 = require_index_node_http(); @@ -79505,7 +80908,7 @@ var require_OTLPMetricExporter3 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/platform/node/index.js -var require_node13 = __commonJS((exports) => { +var require_node14 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; var OTLPMetricExporter_1 = require_OTLPMetricExporter3(); @@ -79515,27 +80918,27 @@ var require_node13 = __commonJS((exports) => { }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/platform/index.js -var require_platform12 = __commonJS((exports) => { +var require_platform13 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var node_1 = require_node13(); + var node_1 = require_node14(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return node_1.OTLPMetricExporter; } }); }); // node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/src/index.js -var require_src31 = __commonJS((exports) => { +var require_src32 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.OTLPMetricExporter = undefined; - var platform_1 = require_platform12(); + var platform_1 = require_platform13(); Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function() { return platform_1.OTLPMetricExporter; } }); }); // node_modules/@opentelemetry/sdk-node/build/src/utils.js -var require_utils14 = __commonJS((exports) => { +var require_utils15 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.buildSamplerFromConfig = exports.getInstanceID = exports.getMeterViewsFromConfiguration = exports.getAggregationType = exports.getInstrumentType = exports.getMeterReadersFromConfiguration = exports.getSpanLimitsFromConfiguration = exports.getSpanProcessorsFromConfiguration = exports.getSpanExporter = exports.getHttpAgentOptionsFromTls = exports.getHeadersFromConfiguration = exports.getLogRecordProcessorsFromConfiguration = exports.getLogRecordExporter = exports.getBatchLogRecordProcessorFromEnv = exports.getBatchLogRecordProcessorConfigFromEnv = exports.getLoggerProviderConfigFromEnv = exports.getPeriodicMetricReaderFromConfiguration = exports.getOtlpMetricExporterFromEnv = exports.getPeriodicExportingMetricReaderFromEnv = exports.getNonNegativeNumberFromEnv = exports.getKeyListFromObjectArray = exports.setupPropagator = exports.setupContextManager = exports.getPropagatorFromConfiguration = exports.getPropagatorFromEnv = exports.getSpanProcessorsFromEnv = exports.getOtlpProtocolFromEnv = exports.getResourceDetectorsFromConfiguration = exports.getResourceDetectorsFromEnv = exports.getResourceFromConfiguration = undefined; var api_1 = require_src(); @@ -79547,7 +80950,7 @@ var require_utils14 = __commonJS((exports) => { var resources_1 = require_src6(); var sdk_trace_base_1 = require_src12(); var propagator_b3_1 = require_src27(); - var propagator_jaeger_1 = require_src28(); + var propagator_jaeger_1 = require_src29(); var context_async_hooks_1 = require_src11(); var exporter_logs_otlp_http_1 = require_src16(); var exporter_logs_otlp_grpc_1 = require_src21(); @@ -79555,9 +80958,9 @@ var require_utils14 = __commonJS((exports) => { var otlp_exporter_base_1 = require_src4(); var otlp_grpc_exporter_base_1 = require_src20(); var sdk_metrics_1 = require_src7(); - var exporter_metrics_otlp_grpc_1 = require_src30(); - var exporter_metrics_otlp_http_1 = require_src29(); - var exporter_metrics_otlp_proto_1 = require_src31(); + var exporter_metrics_otlp_grpc_1 = require_src31(); + var exporter_metrics_otlp_http_1 = require_src30(); + var exporter_metrics_otlp_proto_1 = require_src32(); var sdk_logs_1 = require_src10(); var fs4 = __require("fs"); var RESOURCE_DETECTOR_ENVIRONMENT = "env"; @@ -80368,7 +81771,7 @@ var require_sdk = __commonJS((exports) => { var sdk_trace_node_1 = require_src13(); var semantic_conventions_1 = require_src2(); var core_1 = require_src3(); - var utils_1 = require_utils14(); + var utils_1 = require_utils15(); function getMetricReadersFromEnv() { const metricReaders = []; const enabledExporters = Array.from(new Set((0, core_1.getStringListFromEnv)("OTEL_METRICS_EXPORTER") ?? [])); @@ -82186,7 +83589,7 @@ var require_log = __commonJS((exports) => { }); // node_modules/yaml/dist/schema/yaml-1.1/merge.js -var require_merge2 = __commonJS((exports) => { +var require_merge3 = __commonJS((exports) => { var identity3 = require_identity(); var Scalar = require_Scalar(); var MERGE_KEY = "<<"; @@ -82242,7 +83645,7 @@ var require_merge2 = __commonJS((exports) => { // node_modules/yaml/dist/nodes/addPairToJSMap.js var require_addPairToJSMap = __commonJS((exports) => { var log2 = require_log(); - var merge = require_merge2(); + var merge = require_merge3(); var stringify = require_stringify(); var identity3 = require_identity(); var toJS = require_toJS(); @@ -83519,7 +84922,7 @@ var require_schema4 = __commonJS((exports) => { var bool = require_bool2(); var float = require_float3(); var int = require_int2(); - var merge = require_merge2(); + var merge = require_merge3(); var omap = require_omap(); var pairs = require_pairs(); var set = require_set(); @@ -83562,7 +84965,7 @@ var require_tags = __commonJS((exports) => { var schema = require_schema2(); var schema$1 = require_schema3(); var binary = require_binary(); - var merge = require_merge2(); + var merge = require_merge3(); var omap = require_omap(); var pairs = require_pairs(); var schema$2 = require_schema4(); @@ -87553,7 +88956,7 @@ var require_dist = __commonJS((exports) => { }); // node_modules/@opentelemetry/configuration/build/src/utils.js -var require_utils15 = __commonJS((exports) => { +var require_utils16 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.getHttpTlsConfig = exports.initializeDefaultLoggerProviderConfiguration = exports.initializeDefaultMeterProviderConfiguration = exports.initializeDefaultTracerProviderConfiguration = exports.initializeDefaultConfiguration = exports.getGrpcTlsConfig = exports.substituteEnvVars = undefined; var yaml = require_dist(); @@ -87796,7 +89199,7 @@ var require_EnvironmentConfigFactory = __commonJS((exports) => { exports.setLoggerProvider = exports.setMeterProvider = exports.setTracerProvider = exports.setSampler = exports.setPropagators = exports.setAttributeLimits = exports.setResources = exports.EnvironmentConfigFactory = undefined; var core_1 = require_src3(); var api_1 = require_src(); - var utils_1 = require_utils15(); + var utils_1 = require_utils16(); var EnvReader_1 = require_EnvReader(); var EnvDefinition_1 = require_EnvDefinition(); @@ -98012,7 +99415,7 @@ var require_FileConfigFactory = __commonJS((exports) => { var core_1 = require_src3(); var fs4 = __require("fs"); var yaml = require_dist(); - var utils_1 = require_utils15(); + var utils_1 = require_utils16(); var validateConfig = require_validator(); class FileConfigFactory { @@ -98185,7 +99588,7 @@ var require_ConfigFactory = __commonJS((exports) => { }); // node_modules/@opentelemetry/configuration/build/src/index.js -var require_src32 = __commonJS((exports) => { +var require_src33 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.createConfigFactory = undefined; var ConfigFactory_1 = require_ConfigFactory(); @@ -98195,7 +99598,7 @@ var require_src32 = __commonJS((exports) => { }); // node_modules/@opentelemetry/sdk-node/build/src/semconv.js -var require_semconv7 = __commonJS((exports) => { +var require_semconv8 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.ATTR_SERVICE_NAMESPACE = exports.ATTR_SERVICE_INSTANCE_ID = exports.ATTR_PROCESS_PID = exports.ATTR_HOST_NAME = undefined; exports.ATTR_HOST_NAME = "host.name"; @@ -98262,16 +99665,16 @@ var require_diag2 = __commonJS((exports) => { var require_start = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.setupResource = exports.startNodeSDK = exports.NOOP_SDK = undefined; - var configuration_1 = require_src32(); + var configuration_1 = require_src33(); var api_1 = require_src(); - var utils_1 = require_utils14(); + var utils_1 = require_utils15(); var instrumentation_1 = require_src15(); var sdk_logs_1 = require_src10(); var sdk_metrics_1 = require_src7(); var api_logs_1 = require_src5(); var resources_1 = require_src6(); var context_async_hooks_1 = require_src11(); - var semconv_1 = require_semconv7(); + var semconv_1 = require_semconv8(); var sdk_trace_base_1 = require_src12(); var diag_1 = require_diag2(); exports.NOOP_SDK = { @@ -98395,7 +99798,7 @@ var require_start = __commonJS((exports) => { }); // node_modules/@opentelemetry/sdk-node/build/src/index.js -var require_src33 = __commonJS((exports) => { +var require_src34 = __commonJS((exports) => { Object.defineProperty(exports, "__esModule", { value: true }); exports.startNodeSDK = exports.NodeSDK = exports.tracing = exports.resources = exports.node = exports.metrics = exports.logs = exports.core = exports.contextBase = exports.api = undefined; exports.api = require_src(); @@ -99798,6 +101201,16 @@ function NetworkProtocolNameToValue(name) { return name; } } +function PatchConflictValueToName(value) { + switch (value) { + case "FAIL" /* Fail */: + return "FAIL"; + case "LEAVE_CONFLICT_MARKERS" /* LeaveConflictMarkers */: + return "LEAVE_CONFLICT_MARKERS"; + default: + return value; + } +} function RegistryProtocolValueToName(value) { switch (value) { case "HTTP" /* Http */: @@ -99939,21 +101352,15 @@ class Address extends BaseClient { }; } -class Binding extends BaseClient { +class Agent extends BaseClient { _id = undefined; - _asString = undefined; - _digest = undefined; - _isNull = undefined; + _description = undefined; _name = undefined; - _typeName = undefined; - constructor(ctx, _id, _asString, _digest, _isNull, _name, _typeName) { + constructor(ctx, _id, _description, _name) { super(ctx); this._id = _id; - this._asString = _asString; - this._digest = _digest; - this._isNull = _isNull; + this._description = _description; this._name = _name; - this._typeName = _typeName; } id = async () => { if (this._id) { @@ -99963,217 +101370,55 @@ class Binding extends BaseClient { const response = await ctx.execute(); return response; }; - asAddress = () => { - const ctx = this._ctx.select("asAddress"); - return new Address(ctx); - }; - asCacheVolume = () => { - const ctx = this._ctx.select("asCacheVolume"); - return new CacheVolume(ctx); - }; - asChangeset = () => { - const ctx = this._ctx.select("asChangeset"); - return new Changeset(ctx); - }; - asCheck = () => { - const ctx = this._ctx.select("asCheck"); - return new Check(ctx); - }; - asCheckGroup = () => { - const ctx = this._ctx.select("asCheckGroup"); - return new CheckGroup(ctx); - }; - asCloud = () => { - const ctx = this._ctx.select("asCloud"); - return new Cloud(ctx); - }; - asContainer = () => { - const ctx = this._ctx.select("asContainer"); - return new Container(ctx); - }; - asCurrentModuleAsSDK = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDK"); - return new CurrentModuleAsSDK(ctx); - }; - asCurrentModuleAsSDKClient = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDKClient"); - return new CurrentModuleAsSDKClient(ctx); - }; - asCurrentModuleAsSDKModule = () => { - const ctx = this._ctx.select("asCurrentModuleAsSDKModule"); - return new CurrentModuleAsSDKModule(ctx); - }; - asDiffStat = () => { - const ctx = this._ctx.select("asDiffStat"); - return new DiffStat(ctx); - }; - asDirectory = () => { - const ctx = this._ctx.select("asDirectory"); - return new Directory(ctx); - }; - asEnv = () => { - const ctx = this._ctx.select("asEnv"); - return new Env(ctx); - }; - asEnvFile = () => { - const ctx = this._ctx.select("asEnvFile"); - return new EnvFile(ctx); - }; - asFile = () => { - const ctx = this._ctx.select("asFile"); - return new File(ctx); - }; - asGenerator = () => { - const ctx = this._ctx.select("asGenerator"); - return new Generator(ctx); - }; - asGeneratorGroup = () => { - const ctx = this._ctx.select("asGeneratorGroup"); - return new GeneratorGroup(ctx); - }; - asGitRef = () => { - const ctx = this._ctx.select("asGitRef"); - return new GitRef(ctx); - }; - asGitRepository = () => { - const ctx = this._ctx.select("asGitRepository"); - return new GitRepository(ctx); - }; - asHTTPState = () => { - const ctx = this._ctx.select("asHTTPState"); - return new HTTPState(ctx); - }; - asJSONValue = () => { - const ctx = this._ctx.select("asJSONValue"); - return new JSONValue(ctx); - }; - asLLMContentBlock = () => { - const ctx = this._ctx.select("asLLMContentBlock"); - return new LLMContentBlock(ctx); - }; - asLLMMessage = () => { - const ctx = this._ctx.select("asLLMMessage"); - return new LLMMessage(ctx); - }; - asModule = () => { - const ctx = this._ctx.select("asModule"); - return new Module_(ctx); - }; - asModuleConfigClient = () => { - const ctx = this._ctx.select("asModuleConfigClient"); - return new ModuleConfigClient(ctx); - }; - asModuleSource = () => { - const ctx = this._ctx.select("asModuleSource"); - return new ModuleSource(ctx); - }; - asSchema = () => { - const ctx = this._ctx.select("asSchema"); - return new Schema(ctx); - }; - asSearchResult = () => { - const ctx = this._ctx.select("asSearchResult"); - return new SearchResult(ctx); - }; - asSearchSubmatch = () => { - const ctx = this._ctx.select("asSearchSubmatch"); - return new SearchSubmatch(ctx); - }; - asSecret = () => { - const ctx = this._ctx.select("asSecret"); - return new Secret(ctx); - }; - asService = () => { - const ctx = this._ctx.select("asService"); - return new Service(ctx); - }; - asSocket = () => { - const ctx = this._ctx.select("asSocket"); - return new Socket(ctx); - }; - asStat = () => { - const ctx = this._ctx.select("asStat"); - return new Stat(ctx); - }; - asString = async () => { - if (this._asString) { - return this._asString; + description = async () => { + if (this._description) { + return this._description; } - const ctx = this._ctx.select("asString"); + const ctx = this._ctx.select("description"); const response = await ctx.execute(); return response; }; - asUp = () => { - const ctx = this._ctx.select("asUp"); - return new Up(ctx); - }; - asUpGroup = () => { - const ctx = this._ctx.select("asUpGroup"); - return new UpGroup(ctx); - }; - asVolume = () => { - const ctx = this._ctx.select("asVolume"); - return new Volume(ctx); - }; - asWorkspace = () => { - const ctx = this._ctx.select("asWorkspace"); - return new Workspace(ctx); - }; - asWorkspaceGit = () => { - const ctx = this._ctx.select("asWorkspaceGit"); - return new WorkspaceGit(ctx); - }; - asWorkspaceMigration = () => { - const ctx = this._ctx.select("asWorkspaceMigration"); - return new WorkspaceMigration(ctx); - }; - asWorkspaceMigrationStep = () => { - const ctx = this._ctx.select("asWorkspaceMigrationStep"); - return new WorkspaceMigrationStep(ctx); - }; - asWorkspaceModule = () => { - const ctx = this._ctx.select("asWorkspaceModule"); - return new WorkspaceModule(ctx); - }; - asWorkspaceModuleSetting = () => { - const ctx = this._ctx.select("asWorkspaceModuleSetting"); - return new WorkspaceModuleSetting(ctx); - }; - asWorkspaceSDK = () => { - const ctx = this._ctx.select("asWorkspaceSDK"); - return new WorkspaceSDK(ctx); - }; - digest = async () => { - if (this._digest) { - return this._digest; + name = async () => { + if (this._name) { + return this._name; } - const ctx = this._ctx.select("digest"); + const ctx = this._ctx.select("name"); const response = await ctx.execute(); return response; }; - isNull = async () => { - if (this._isNull) { - return this._isNull; - } - const ctx = this._ctx.select("isNull"); + originalModule = () => { + const ctx = this._ctx.select("originalModule"); + return new Module_(ctx); + }; + path = async () => { + const ctx = this._ctx.select("path"); const response = await ctx.execute(); return response; }; - name = async () => { - if (this._name) { - return this._name; +} + +class AgentGroup extends BaseClient { + _id = undefined; + constructor(ctx, _id) { + super(ctx); + this._id = _id; + } + id = async () => { + if (this._id) { + return this._id; } - const ctx = this._ctx.select("name"); + const ctx = this._ctx.select("id"); const response = await ctx.execute(); return response; }; - typeName = async () => { - if (this._typeName) { - return this._typeName; - } - const ctx = this._ctx.select("typeName"); + compose = (opts) => { + const ctx = this._ctx.select("compose", { ...opts }); + return new LLM(ctx); + }; + list = async () => { + const ctx = this._ctx.select("list").select("id"); const response = await ctx.execute(); - return response; + return response.map((r) => new Agent(ctx.copy().selectNode(r.id, "Agent"))); }; } @@ -100339,9 +101584,13 @@ class Check extends BaseClient { const response = await ctx.execute(); return response; }; - error = () => { - const ctx = this._ctx.select("error"); - return new Error2(ctx); + error = async () => { + const ctx = this._ctx.select("error").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Error2(ctx.copy().selectNode(response, "Error")); }; name = async () => { if (this._name) { @@ -100517,9 +101766,13 @@ class Container extends BaseClient { const ctx = this._ctx.select("directory", { path, ...opts }); return new Directory(ctx); }; - dockerHealthcheck = () => { - const ctx = this._ctx.select("dockerHealthcheck"); - return new HealthcheckConfig(ctx); + dockerHealthcheck = async () => { + const ctx = this._ctx.select("dockerHealthcheck").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new HealthcheckConfig(ctx.copy().selectNode(response, "HealthcheckConfig")); }; entrypoint = async () => { const ctx = this._ctx.select("entrypoint"); @@ -100676,9 +101929,13 @@ class Container extends BaseClient { const ctx = this._ctx.select("rootfs"); return new Directory(ctx); }; - stat = (path, opts) => { - const ctx = this._ctx.select("stat", { path, ...opts }); - return new Stat(ctx); + stat = async (path, opts) => { + const ctx = this._ctx.select("stat", { path, ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; stderr = async () => { if (this._stderr) { @@ -100949,8 +102206,8 @@ class CurrentModule extends BaseClient { const response = await ctx.execute(); return response; }; - asSDK = (opts) => { - const ctx = this._ctx.select("asSDK", { ...opts }); + asSDK = (workspace) => { + const ctx = this._ctx.select("asSDK", { workspace }); return new CurrentModuleAsSDK(ctx); }; dependencies = async () => { @@ -101294,9 +102551,13 @@ class Directory extends BaseClient { const response = await ctx.execute(); return response.map((r) => new SearchResult(ctx.copy().selectNode(r.id, "SearchResult"))); }; - stat = (path, opts) => { - const ctx = this._ctx.select("stat", { path, ...opts }); - return new Stat(ctx); + stat = async (path, opts) => { + const ctx = this._ctx.select("stat", { path, ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -101335,12 +102596,18 @@ class Directory extends BaseClient { const ctx = this._ctx.select("withNewFile", { path, contents, ...opts }); return new Directory(ctx); }; - withPatch = (patch) => { - const ctx = this._ctx.select("withPatch", { patch }); + withPatch = (patch, opts) => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName } + }; + const ctx = this._ctx.select("withPatch", { patch, ...opts, __metadata: metadata }); return new Directory(ctx); }; - withPatchFile = (patch) => { - const ctx = this._ctx.select("withPatchFile", { patch }); + withPatchFile = (patch, opts) => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName } + }; + const ctx = this._ctx.select("withPatchFile", { patch, ...opts, __metadata: metadata }); return new Directory(ctx); }; withSymlink = (target, linkName) => { @@ -101645,9 +102912,13 @@ class EnumTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -101710,9 +102981,13 @@ class EnumValueTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; value = async () => { if (this._value) { @@ -101724,435 +102999,6 @@ class EnumValueTypeDef extends BaseClient { }; } -class Env extends BaseClient { - _id = undefined; - constructor(ctx, _id) { - super(ctx); - this._id = _id; - } - id = async () => { - if (this._id) { - return this._id; - } - const ctx = this._ctx.select("id"); - const response = await ctx.execute(); - return response; - }; - check = (name) => { - const ctx = this._ctx.select("check", { name }); - return new Check(ctx); - }; - checks = (opts) => { - const ctx = this._ctx.select("checks", { ...opts }); - return new CheckGroup(ctx); - }; - input = (name) => { - const ctx = this._ctx.select("input", { name }); - return new Binding(ctx); - }; - inputs = async () => { - const ctx = this._ctx.select("inputs").select("id"); - const response = await ctx.execute(); - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))); - }; - output = (name) => { - const ctx = this._ctx.select("output", { name }); - return new Binding(ctx); - }; - outputs = async () => { - const ctx = this._ctx.select("outputs").select("id"); - const response = await ctx.execute(); - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))); - }; - services = (opts) => { - const ctx = this._ctx.select("services", { ...opts }); - return new UpGroup(ctx); - }; - withAddressInput = (name, value, description) => { - const ctx = this._ctx.select("withAddressInput", { name, value, description }); - return new Env(ctx); - }; - withAddressOutput = (name, description) => { - const ctx = this._ctx.select("withAddressOutput", { name, description }); - return new Env(ctx); - }; - withCacheVolumeInput = (name, value, description) => { - const ctx = this._ctx.select("withCacheVolumeInput", { name, value, description }); - return new Env(ctx); - }; - withCacheVolumeOutput = (name, description) => { - const ctx = this._ctx.select("withCacheVolumeOutput", { name, description }); - return new Env(ctx); - }; - withChangesetInput = (name, value, description) => { - const ctx = this._ctx.select("withChangesetInput", { name, value, description }); - return new Env(ctx); - }; - withChangesetOutput = (name, description) => { - const ctx = this._ctx.select("withChangesetOutput", { name, description }); - return new Env(ctx); - }; - withCheckGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withCheckGroupInput", { name, value, description }); - return new Env(ctx); - }; - withCheckGroupOutput = (name, description) => { - const ctx = this._ctx.select("withCheckGroupOutput", { name, description }); - return new Env(ctx); - }; - withCheckInput = (name, value, description) => { - const ctx = this._ctx.select("withCheckInput", { name, value, description }); - return new Env(ctx); - }; - withCheckOutput = (name, description) => { - const ctx = this._ctx.select("withCheckOutput", { name, description }); - return new Env(ctx); - }; - withCloudInput = (name, value, description) => { - const ctx = this._ctx.select("withCloudInput", { name, value, description }); - return new Env(ctx); - }; - withCloudOutput = (name, description) => { - const ctx = this._ctx.select("withCloudOutput", { name, description }); - return new Env(ctx); - }; - withContainerInput = (name, value, description) => { - const ctx = this._ctx.select("withContainerInput", { name, value, description }); - return new Env(ctx); - }; - withContainerOutput = (name, description) => { - const ctx = this._ctx.select("withContainerOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModule = () => { - const ctx = this._ctx.select("withCurrentModule"); - return new Env(ctx); - }; - withCurrentModuleAsSDKClientInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKClientInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKClientOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKClientOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKModuleInput", { name, value, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKModuleOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKModuleOutput", { name, description }); - return new Env(ctx); - }; - withCurrentModuleAsSDKOutput = (name, description) => { - const ctx = this._ctx.select("withCurrentModuleAsSDKOutput", { name, description }); - return new Env(ctx); - }; - withDiffStatInput = (name, value, description) => { - const ctx = this._ctx.select("withDiffStatInput", { name, value, description }); - return new Env(ctx); - }; - withDiffStatOutput = (name, description) => { - const ctx = this._ctx.select("withDiffStatOutput", { name, description }); - return new Env(ctx); - }; - withDirectoryInput = (name, value, description) => { - const ctx = this._ctx.select("withDirectoryInput", { name, value, description }); - return new Env(ctx); - }; - withDirectoryOutput = (name, description) => { - const ctx = this._ctx.select("withDirectoryOutput", { name, description }); - return new Env(ctx); - }; - withEnvFileInput = (name, value, description) => { - const ctx = this._ctx.select("withEnvFileInput", { name, value, description }); - return new Env(ctx); - }; - withEnvFileOutput = (name, description) => { - const ctx = this._ctx.select("withEnvFileOutput", { name, description }); - return new Env(ctx); - }; - withEnvInput = (name, value, description) => { - const ctx = this._ctx.select("withEnvInput", { name, value, description }); - return new Env(ctx); - }; - withEnvOutput = (name, description) => { - const ctx = this._ctx.select("withEnvOutput", { name, description }); - return new Env(ctx); - }; - withFileInput = (name, value, description) => { - const ctx = this._ctx.select("withFileInput", { name, value, description }); - return new Env(ctx); - }; - withFileOutput = (name, description) => { - const ctx = this._ctx.select("withFileOutput", { name, description }); - return new Env(ctx); - }; - withGeneratorGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withGeneratorGroupInput", { name, value, description }); - return new Env(ctx); - }; - withGeneratorGroupOutput = (name, description) => { - const ctx = this._ctx.select("withGeneratorGroupOutput", { name, description }); - return new Env(ctx); - }; - withGeneratorInput = (name, value, description) => { - const ctx = this._ctx.select("withGeneratorInput", { name, value, description }); - return new Env(ctx); - }; - withGeneratorOutput = (name, description) => { - const ctx = this._ctx.select("withGeneratorOutput", { name, description }); - return new Env(ctx); - }; - withGitRefInput = (name, value, description) => { - const ctx = this._ctx.select("withGitRefInput", { name, value, description }); - return new Env(ctx); - }; - withGitRefOutput = (name, description) => { - const ctx = this._ctx.select("withGitRefOutput", { name, description }); - return new Env(ctx); - }; - withGitRepositoryInput = (name, value, description) => { - const ctx = this._ctx.select("withGitRepositoryInput", { name, value, description }); - return new Env(ctx); - }; - withGitRepositoryOutput = (name, description) => { - const ctx = this._ctx.select("withGitRepositoryOutput", { name, description }); - return new Env(ctx); - }; - withHTTPStateInput = (name, value, description) => { - const ctx = this._ctx.select("withHTTPStateInput", { name, value, description }); - return new Env(ctx); - }; - withHTTPStateOutput = (name, description) => { - const ctx = this._ctx.select("withHTTPStateOutput", { name, description }); - return new Env(ctx); - }; - withJSONValueInput = (name, value, description) => { - const ctx = this._ctx.select("withJSONValueInput", { name, value, description }); - return new Env(ctx); - }; - withJSONValueOutput = (name, description) => { - const ctx = this._ctx.select("withJSONValueOutput", { name, description }); - return new Env(ctx); - }; - withLLMContentBlockInput = (name, value, description) => { - const ctx = this._ctx.select("withLLMContentBlockInput", { name, value, description }); - return new Env(ctx); - }; - withLLMContentBlockOutput = (name, description) => { - const ctx = this._ctx.select("withLLMContentBlockOutput", { name, description }); - return new Env(ctx); - }; - withLLMMessageInput = (name, value, description) => { - const ctx = this._ctx.select("withLLMMessageInput", { name, value, description }); - return new Env(ctx); - }; - withLLMMessageOutput = (name, description) => { - const ctx = this._ctx.select("withLLMMessageOutput", { name, description }); - return new Env(ctx); - }; - withMainModule = (module_) => { - const ctx = this._ctx.select("withMainModule", { - module: module_ - }); - return new Env(ctx); - }; - withModule = (module_) => { - const ctx = this._ctx.select("withModule", { - module: module_ - }); - return new Env(ctx); - }; - withModuleConfigClientInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleConfigClientInput", { name, value, description }); - return new Env(ctx); - }; - withModuleConfigClientOutput = (name, description) => { - const ctx = this._ctx.select("withModuleConfigClientOutput", { name, description }); - return new Env(ctx); - }; - withModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleInput", { name, value, description }); - return new Env(ctx); - }; - withModuleOutput = (name, description) => { - const ctx = this._ctx.select("withModuleOutput", { name, description }); - return new Env(ctx); - }; - withModuleSourceInput = (name, value, description) => { - const ctx = this._ctx.select("withModuleSourceInput", { name, value, description }); - return new Env(ctx); - }; - withModuleSourceOutput = (name, description) => { - const ctx = this._ctx.select("withModuleSourceOutput", { name, description }); - return new Env(ctx); - }; - withSchemaInput = (name, value, description) => { - const ctx = this._ctx.select("withSchemaInput", { name, value, description }); - return new Env(ctx); - }; - withSchemaOutput = (name, description) => { - const ctx = this._ctx.select("withSchemaOutput", { name, description }); - return new Env(ctx); - }; - withSearchResultInput = (name, value, description) => { - const ctx = this._ctx.select("withSearchResultInput", { name, value, description }); - return new Env(ctx); - }; - withSearchResultOutput = (name, description) => { - const ctx = this._ctx.select("withSearchResultOutput", { name, description }); - return new Env(ctx); - }; - withSearchSubmatchInput = (name, value, description) => { - const ctx = this._ctx.select("withSearchSubmatchInput", { name, value, description }); - return new Env(ctx); - }; - withSearchSubmatchOutput = (name, description) => { - const ctx = this._ctx.select("withSearchSubmatchOutput", { name, description }); - return new Env(ctx); - }; - withSecretInput = (name, value, description) => { - const ctx = this._ctx.select("withSecretInput", { name, value, description }); - return new Env(ctx); - }; - withSecretOutput = (name, description) => { - const ctx = this._ctx.select("withSecretOutput", { name, description }); - return new Env(ctx); - }; - withServiceInput = (name, value, description) => { - const ctx = this._ctx.select("withServiceInput", { name, value, description }); - return new Env(ctx); - }; - withServiceOutput = (name, description) => { - const ctx = this._ctx.select("withServiceOutput", { name, description }); - return new Env(ctx); - }; - withSocketInput = (name, value, description) => { - const ctx = this._ctx.select("withSocketInput", { name, value, description }); - return new Env(ctx); - }; - withSocketOutput = (name, description) => { - const ctx = this._ctx.select("withSocketOutput", { name, description }); - return new Env(ctx); - }; - withStatInput = (name, value, description) => { - const ctx = this._ctx.select("withStatInput", { name, value, description }); - return new Env(ctx); - }; - withStatOutput = (name, description) => { - const ctx = this._ctx.select("withStatOutput", { name, description }); - return new Env(ctx); - }; - withStringInput = (name, value, description) => { - const ctx = this._ctx.select("withStringInput", { name, value, description }); - return new Env(ctx); - }; - withStringOutput = (name, description) => { - const ctx = this._ctx.select("withStringOutput", { name, description }); - return new Env(ctx); - }; - withUpGroupInput = (name, value, description) => { - const ctx = this._ctx.select("withUpGroupInput", { name, value, description }); - return new Env(ctx); - }; - withUpGroupOutput = (name, description) => { - const ctx = this._ctx.select("withUpGroupOutput", { name, description }); - return new Env(ctx); - }; - withUpInput = (name, value, description) => { - const ctx = this._ctx.select("withUpInput", { name, value, description }); - return new Env(ctx); - }; - withUpOutput = (name, description) => { - const ctx = this._ctx.select("withUpOutput", { name, description }); - return new Env(ctx); - }; - withVolumeInput = (name, value, description) => { - const ctx = this._ctx.select("withVolumeInput", { name, value, description }); - return new Env(ctx); - }; - withVolumeOutput = (name, description) => { - const ctx = this._ctx.select("withVolumeOutput", { name, description }); - return new Env(ctx); - }; - withWorkspace = (workspace) => { - const ctx = this._ctx.select("withWorkspace", { workspace }); - return new Env(ctx); - }; - withWorkspaceGitInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceGitInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceGitOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceGitOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceMigrationStepInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationStepInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceMigrationStepOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceMigrationStepOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceModuleInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceModuleInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceModuleOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceModuleOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceModuleSettingInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceModuleSettingInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceModuleSettingOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceModuleSettingOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceOutput", { name, description }); - return new Env(ctx); - }; - withWorkspaceSDKInput = (name, value, description) => { - const ctx = this._ctx.select("withWorkspaceSDKInput", { name, value, description }); - return new Env(ctx); - }; - withWorkspaceSDKOutput = (name, description) => { - const ctx = this._ctx.select("withWorkspaceSDKOutput", { name, description }); - return new Env(ctx); - }; - withoutOutputs = () => { - const ctx = this._ctx.select("withoutOutputs"); - return new Env(ctx); - }; - workspace = () => { - const ctx = this._ctx.select("workspace"); - return new Directory(ctx); - }; - with = (arg) => { - return arg(this); - }; -} - class EnvFile extends BaseClient { _id = undefined; _exists = undefined; @@ -102366,9 +103212,13 @@ class FieldTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; typeDef = () => { const ctx = this._ctx.select("typeDef"); @@ -102459,9 +103309,13 @@ class File extends BaseClient { const response = await ctx.execute(); return response; }; - stat = () => { - const ctx = this._ctx.select("stat"); - return new Stat(ctx); + stat = async () => { + const ctx = this._ctx.select("stat").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Stat(ctx.copy().selectNode(response, "Stat")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -102540,9 +103394,13 @@ class Function_ extends BaseClient { const ctx = this._ctx.select("returnType"); return new TypeDef(ctx); }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -102552,6 +103410,10 @@ class Function_ extends BaseClient { const response = await ctx.execute(); return response; }; + withAgent = () => { + const ctx = this._ctx.select("withAgent"); + return new Function_(ctx); + }; withArg = (name, typeDef, opts) => { const ctx = this._ctx.select("withArg", { name, typeDef, ...opts }); return new Function_(ctx); @@ -102671,9 +103533,13 @@ class FunctionArg extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; typeDef = () => { const ctx = this._ctx.select("typeDef"); @@ -102953,14 +103819,169 @@ class GeneratorGroup extends BaseClient { }; } +class GitCommit extends BaseClient { + _id = undefined; + _authorEmail = undefined; + _authorName = undefined; + _authoredDate = undefined; + _committedDate = undefined; + _committerEmail = undefined; + _committerName = undefined; + _message = undefined; + _messageBody = undefined; + _messageHeadline = undefined; + _sha = undefined; + _shortSha = undefined; + constructor(ctx, _id, _authorEmail, _authorName, _authoredDate, _committedDate, _committerEmail, _committerName, _message, _messageBody, _messageHeadline, _sha, _shortSha) { + super(ctx); + this._id = _id; + this._authorEmail = _authorEmail; + this._authorName = _authorName; + this._authoredDate = _authoredDate; + this._committedDate = _committedDate; + this._committerEmail = _committerEmail; + this._committerName = _committerName; + this._message = _message; + this._messageBody = _messageBody; + this._messageHeadline = _messageHeadline; + this._sha = _sha; + this._shortSha = _shortSha; + } + id = async () => { + if (this._id) { + return this._id; + } + const ctx = this._ctx.select("id"); + const response = await ctx.execute(); + return response; + }; + ancestorReleaseTag = async (opts) => { + const ctx = this._ctx.select("ancestorReleaseTag", { ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")); + }; + authorEmail = async () => { + if (this._authorEmail) { + return this._authorEmail; + } + const ctx = this._ctx.select("authorEmail"); + const response = await ctx.execute(); + return response; + }; + authorName = async () => { + if (this._authorName) { + return this._authorName; + } + const ctx = this._ctx.select("authorName"); + const response = await ctx.execute(); + return response; + }; + authoredDate = async () => { + if (this._authoredDate) { + return this._authoredDate; + } + const ctx = this._ctx.select("authoredDate"); + const response = await ctx.execute(); + return response; + }; + committedDate = async () => { + if (this._committedDate) { + return this._committedDate; + } + const ctx = this._ctx.select("committedDate"); + const response = await ctx.execute(); + return response; + }; + committerEmail = async () => { + if (this._committerEmail) { + return this._committerEmail; + } + const ctx = this._ctx.select("committerEmail"); + const response = await ctx.execute(); + return response; + }; + committerName = async () => { + if (this._committerName) { + return this._committerName; + } + const ctx = this._ctx.select("committerName"); + const response = await ctx.execute(); + return response; + }; + message = async () => { + if (this._message) { + return this._message; + } + const ctx = this._ctx.select("message"); + const response = await ctx.execute(); + return response; + }; + messageBody = async () => { + if (this._messageBody) { + return this._messageBody; + } + const ctx = this._ctx.select("messageBody"); + const response = await ctx.execute(); + return response; + }; + messageHeadline = async () => { + if (this._messageHeadline) { + return this._messageHeadline; + } + const ctx = this._ctx.select("messageHeadline"); + const response = await ctx.execute(); + return response; + }; + parentShas = async () => { + const ctx = this._ctx.select("parentShas"); + const response = await ctx.execute(); + return response; + }; + releaseTag = async (opts) => { + const ctx = this._ctx.select("releaseTag", { ...opts }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")); + }; + sha = async () => { + if (this._sha) { + return this._sha; + } + const ctx = this._ctx.select("sha"); + const response = await ctx.execute(); + return response; + }; + shortSha = async () => { + if (this._shortSha) { + return this._shortSha; + } + const ctx = this._ctx.select("shortSha"); + const response = await ctx.execute(); + return response; + }; + tree = (opts) => { + const ctx = this._ctx.select("tree", { ...opts }); + return new Directory(ctx); + }; +} + class GitRef extends BaseClient { _id = undefined; _commit = undefined; + _commitSHA = undefined; + _name = undefined; _ref = undefined; - constructor(ctx, _id, _commit, _ref) { + constructor(ctx, _id, _commit, _commitSHA, _name, _ref) { super(ctx); this._id = _id; this._commit = _commit; + this._commitSHA = _commitSHA; + this._name = _name; this._ref = _ref; } id = async () => { @@ -102983,10 +104004,31 @@ class GitRef extends BaseClient { const response = await ctx.execute(); return response; }; + commitSHA = async () => { + if (this._commitSHA) { + return this._commitSHA; + } + const ctx = this._ctx.select("commitSHA"); + const response = await ctx.execute(); + return response; + }; commonAncestor = (other) => { const ctx = this._ctx.select("commonAncestor", { other }); return new GitRef(ctx); }; + log = async (opts) => { + const ctx = this._ctx.select("log", { ...opts }).select("id"); + const response = await ctx.execute(); + return response.map((r) => new GitCommit(ctx.copy().selectNode(r.id, "GitCommit"))); + }; + name = async () => { + if (this._name) { + return this._name; + } + const ctx = this._ctx.select("name"); + const response = await ctx.execute(); + return response; + }; ref = async () => { if (this._ref) { return this._ref; @@ -102995,6 +104037,10 @@ class GitRef extends BaseClient { const response = await ctx.execute(); return response; }; + targetCommit = () => { + const ctx = this._ctx.select("targetCommit"); + return new GitCommit(ctx); + }; tree = (opts) => { const ctx = this._ctx.select("tree", { ...opts }); return new Directory(ctx); @@ -103035,7 +104081,7 @@ class GitRepository extends BaseClient { }; commit = (id) => { const ctx = this._ctx.select("commit", { id }); - return new GitRef(ctx); + return new GitCommit(ctx); }; head = () => { const ctx = this._ctx.select("head"); @@ -103071,23 +104117,6 @@ class GitRepository extends BaseClient { return response; }; } - -class HTTPState extends BaseClient { - _id = undefined; - constructor(ctx, _id) { - super(ctx); - this._id = _id; - } - id = async () => { - if (this._id) { - return this._id; - } - const ctx = this._ctx.select("id"); - const response = await ctx.execute(); - return response; - }; -} - class HealthcheckConfig extends BaseClient { _id = undefined; _interval = undefined; @@ -103291,9 +104320,13 @@ class InterfaceTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -103400,25 +104433,29 @@ class JSONValue extends BaseClient { class LLM extends BaseClient { _id = undefined; + _contextTokens = undefined; _contextWindow = undefined; _hasPending = undefined; _lastReply = undefined; _model = undefined; _portableID = undefined; _provider = undefined; + _reasoningEffort = undefined; _replay = undefined; _sync = undefined; _tools = undefined; _transcript = undefined; - constructor(ctx, _id, _contextWindow, _hasPending, _lastReply, _model, _portableID, _provider, _replay, _sync, _tools, _transcript) { + constructor(ctx, _id, _contextTokens, _contextWindow, _hasPending, _lastReply, _model, _portableID, _provider, _reasoningEffort, _replay, _sync, _tools, _transcript) { super(ctx); this._id = _id; + this._contextTokens = _contextTokens; this._contextWindow = _contextWindow; this._hasPending = _hasPending; this._lastReply = _lastReply; this._model = _model; this._portableID = _portableID; this._provider = _provider; + this._reasoningEffort = _reasoningEffort; this._replay = _replay; this._sync = _sync; this._tools = _tools; @@ -103432,9 +104469,13 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - bindResult = (name) => { - const ctx = this._ctx.select("bindResult", { name }); - return new Binding(ctx); + contextTokens = async () => { + if (this._contextTokens) { + return this._contextTokens; + } + const ctx = this._ctx.select("contextTokens"); + const response = await ctx.execute(); + return response; }; contextWindow = async () => { if (this._contextWindow) { @@ -103444,10 +104485,6 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - env = () => { - const ctx = this._ctx.select("env"); - return new Env(ctx); - }; fork = (label) => { const ctx = this._ctx.select("fork", { label }); return new LLM(ctx); @@ -103501,11 +104538,24 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; + reasoningEffort = async () => { + if (this._reasoningEffort) { + return this._reasoningEffort; + } + const ctx = this._ctx.select("reasoningEffort"); + const response = await ctx.execute(); + return response; + }; replay = async () => { const ctx = this._ctx.select("replay"); const response = await ctx.execute(); return new LLM(ctx.copy().selectNode(response, "LLM")); }; + skills = async () => { + const ctx = this._ctx.select("skills").select("id"); + const response = await ctx.execute(); + return response.map((r) => new LLMSkill(ctx.copy().selectNode(r.id, "LLMSkill"))); + }; step = (opts) => { const ctx = this._ctx.select("step", { ...opts }); return new LLM(ctx); @@ -103535,17 +104585,6 @@ class LLM extends BaseClient { const response = await ctx.execute(); return response; }; - withBlockedFunction = (typeName, function_) => { - const ctx = this._ctx.select("withBlockedFunction", { - typeName, - function: function_ - }); - return new LLM(ctx); - }; - withEnv = (env) => { - const ctx = this._ctx.select("withEnv", { env }); - return new LLM(ctx); - }; withMCPServer = (name, service) => { const ctx = this._ctx.select("withMCPServer", { name, service }); return new LLM(ctx); @@ -103554,10 +104593,6 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withModel", { model, ...opts }); return new LLM(ctx); }; - withObject = (tag, object) => { - const ctx = this._ctx.select("withObject", { tag, object }); - return new LLM(ctx); - }; withPrompt = (prompt) => { const ctx = this._ctx.select("withPrompt", { prompt }); return new LLM(ctx); @@ -103566,12 +104601,16 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withPromptFile", { file }); return new LLM(ctx); }; + withReasoningEffort = (effort) => { + const ctx = this._ctx.select("withReasoningEffort", { effort }); + return new LLM(ctx); + }; withResponse = (content, opts) => { const ctx = this._ctx.select("withResponse", { content, ...opts }); return new LLM(ctx); }; - withStaticTools = () => { - const ctx = this._ctx.select("withStaticTools"); + withSkills = (directory) => { + const ctx = this._ctx.select("withSkills", { directory }); return new LLM(ctx); }; withSystemPrompt = (prompt) => { @@ -103582,6 +104621,14 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withToolResult", { callId, content, errored }); return new LLM(ctx); }; + withTools = (object, opts) => { + const ctx = this._ctx.select("withTools", { object, ...opts }); + return new LLM(ctx); + }; + withWorkspace = (workspace) => { + const ctx = this._ctx.select("withWorkspace", { workspace }); + return new LLM(ctx); + }; withoutDefaultSystemPrompt = () => { const ctx = this._ctx.select("withoutDefaultSystemPrompt"); return new LLM(ctx); @@ -103594,6 +104641,10 @@ class LLM extends BaseClient { const ctx = this._ctx.select("withoutSystemPrompts"); return new LLM(ctx); }; + workspace = () => { + const ctx = this._ctx.select("workspace"); + return new Workspace(ctx); + }; with = (arg) => { return arg(this); }; @@ -103720,6 +104771,42 @@ class LLMMessage extends BaseClient { }; } +class LLMSkill extends BaseClient { + _id = undefined; + _description = undefined; + _name = undefined; + constructor(ctx, _id, _description, _name) { + super(ctx); + this._id = _id; + this._description = _description; + this._name = _name; + } + id = async () => { + if (this._id) { + return this._id; + } + const ctx = this._ctx.select("id"); + const response = await ctx.execute(); + return response; + }; + description = async () => { + if (this._description) { + return this._description; + } + const ctx = this._ctx.select("description"); + const response = await ctx.execute(); + return response; + }; + name = async () => { + if (this._name) { + return this._name; + } + const ctx = this._ctx.select("name"); + const response = await ctx.execute(); + return response; + }; +} + class LLMTokenUsage extends BaseClient { _id = undefined; _cachedTokenReads = undefined; @@ -103924,13 +105011,21 @@ class Module_ extends BaseClient { const response = await ctx.execute(); return response.map((r) => new TypeDef(ctx.copy().selectNode(r.id, "TypeDef"))); }; - runtime = () => { - const ctx = this._ctx.select("runtime"); - return new Container(ctx); + runtime = async () => { + const ctx = this._ctx.select("runtime").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Container(ctx.copy().selectNode(response, "Container")); }; - sdk = () => { - const ctx = this._ctx.select("sdk"); - return new SDKConfig(ctx); + sdk = async () => { + const ctx = this._ctx.select("sdk").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")); }; serve = async (opts) => { if (this._serve) { @@ -103943,9 +105038,13 @@ class Module_ extends BaseClient { const ctx = this._ctx.select("services", { ...opts }); return new UpGroup(ctx); }; - source = () => { - const ctx = this._ctx.select("source"); - return new ModuleSource(ctx); + source = async () => { + const ctx = this._ctx.select("source").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ModuleSource(ctx.copy().selectNode(response, "ModuleSource")); }; sync = async () => { const ctx = this._ctx.select("sync"); @@ -104145,6 +105244,10 @@ class ModuleSource extends BaseClient { const response = await ctx.execute(); return response; }; + generate = (workspace) => { + const ctx = this._ctx.select("generate", { workspace }); + return new Workspace(ctx); + }; generateLocalDependencies = (workspace) => { const ctx = this._ctx.select("generateLocalDependencies", { workspace }); return new Changeset(ctx); @@ -104233,9 +105336,13 @@ class ModuleSource extends BaseClient { const response = await ctx.execute(); return response; }; - sdk = () => { - const ctx = this._ctx.select("sdk"); - return new SDKConfig(ctx); + sdk = async () => { + const ctx = this._ctx.select("sdk").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")); }; sourceRootSubpath = async () => { if (this._sourceRootSubpath) { @@ -104398,9 +105505,13 @@ class ObjectTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - constructor_ = () => { - const ctx = this._ctx.select("constructor"); - return new Function_(ctx); + constructor_ = async () => { + const ctx = this._ctx.select("constructor").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new Function_(ctx.copy().selectNode(response, "Function")); }; deprecated = async () => { if (this._deprecated) { @@ -104436,9 +105547,13 @@ class ObjectTypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - sourceMap = () => { - const ctx = this._ctx.select("sourceMap"); - return new SourceMap(ctx); + sourceMap = async () => { + const ctx = this._ctx.select("sourceMap").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")); }; sourceModuleName = async () => { if (this._sourceModuleName) { @@ -104547,10 +105662,6 @@ class Client extends BaseClient { const ctx = this._ctx.select("container", { ...opts }); return new Container(ctx); }; - currentEnv = () => { - const ctx = this._ctx.select("currentEnv"); - return new Env(ctx); - }; currentFunctionCall = () => { const ctx = this._ctx.select("currentFunctionCall"); return new FunctionCall(ctx); @@ -104559,6 +105670,10 @@ class Client extends BaseClient { const ctx = this._ctx.select("currentModule"); return new CurrentModule(ctx); }; + currentNode = () => { + const ctx = this._ctx.select("currentNode"); + return new _NodeClient(ctx); + }; currentTypeDefs = async (opts) => { const ctx = this._ctx.select("currentTypeDefs", { ...opts }).select("id"); const response = await ctx.execute(); @@ -104581,9 +105696,9 @@ class Client extends BaseClient { const ctx = this._ctx.select("engine"); return new Engine(ctx); }; - env = (opts) => { - const ctx = this._ctx.select("env", { ...opts }); - return new Env(ctx); + engineVolume = (name, opts) => { + const ctx = this._ctx.select("engineVolume", { name, ...opts }); + return new Volume(ctx); }; envFile = (opts) => { const ctx = this._ctx.select("envFile", { ...opts }); @@ -104636,9 +105751,13 @@ class Client extends BaseClient { const ctx = this._ctx.select("moduleSource", { refString, ...opts, __metadata: metadata }); return new ModuleSource(ctx); }; - node = (id) => { - const ctx = this._ctx.select("node", { id }); - return new _NodeClient(ctx); + node = async (id) => { + const ctx = this._ctx.select("node", { id }).select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new _NodeClient(ctx.copy().selectNode(response, "Node")); }; schema = (json) => { const ctx = this._ctx.select("schema", { json }); @@ -105177,29 +106296,53 @@ class TypeDef extends BaseClient { const response = await ctx.execute(); return response; }; - asEnum = () => { - const ctx = this._ctx.select("asEnum"); - return new EnumTypeDef(ctx); + asEnum = async () => { + const ctx = this._ctx.select("asEnum").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new EnumTypeDef(ctx.copy().selectNode(response, "EnumTypeDef")); }; - asInput = () => { - const ctx = this._ctx.select("asInput"); - return new InputTypeDef(ctx); + asInput = async () => { + const ctx = this._ctx.select("asInput").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new InputTypeDef(ctx.copy().selectNode(response, "InputTypeDef")); }; - asInterface = () => { - const ctx = this._ctx.select("asInterface"); - return new InterfaceTypeDef(ctx); + asInterface = async () => { + const ctx = this._ctx.select("asInterface").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new InterfaceTypeDef(ctx.copy().selectNode(response, "InterfaceTypeDef")); }; - asList = () => { - const ctx = this._ctx.select("asList"); - return new ListTypeDef(ctx); + asList = async () => { + const ctx = this._ctx.select("asList").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ListTypeDef(ctx.copy().selectNode(response, "ListTypeDef")); }; - asObject = () => { - const ctx = this._ctx.select("asObject"); - return new ObjectTypeDef(ctx); + asObject = async () => { + const ctx = this._ctx.select("asObject").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ObjectTypeDef(ctx.copy().selectNode(response, "ObjectTypeDef")); }; - asScalar = () => { - const ctx = this._ctx.select("asScalar"); - return new ScalarTypeDef(ctx); + asScalar = async () => { + const ctx = this._ctx.select("asScalar").select("id"); + const response = await ctx.execute(); + if (response === null) { + return null; + } + return new ScalarTypeDef(ctx.copy().selectNode(response, "ScalarTypeDef")); }; kind = async () => { if (this._kind) { @@ -105415,8 +106558,12 @@ class Workspace extends BaseClient { const response = await ctx.execute(); return response; }; - changes = () => { - const ctx = this._ctx.select("changes"); + agents = (opts) => { + const ctx = this._ctx.select("agents", { ...opts }); + return new AgentGroup(ctx); + }; + changes = (opts) => { + const ctx = this._ctx.select("changes", { ...opts }); return new Changeset(ctx); }; checks = (opts) => { @@ -105467,6 +106614,11 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("file", { path }); return new File(ctx); }; + findRoots = async (opts) => { + const ctx = this._ctx.select("findRoots", { ...opts }); + const response = await ctx.execute(); + return response; + }; findUp = async (name, opts) => { if (this._findUp) { return this._findUp; @@ -105505,6 +106657,10 @@ class Workspace extends BaseClient { const response = await ctx.execute(); return response.map((r) => new WorkspaceModule(ctx.copy().selectNode(r.id, "WorkspaceModule"))); }; + reloaded = () => { + const ctx = this._ctx.select("reloaded"); + return new Workspace(ctx); + }; sdk = (name) => { const ctx = this._ctx.select("sdk", { name }); return new WorkspaceSDK(ctx); @@ -105552,6 +106708,14 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("withModule", { ref, ...opts }); return new Workspace(ctx); }; + withMountedDirectory = (path, source) => { + const ctx = this._ctx.select("withMountedDirectory", { path, source }); + return new Workspace(ctx); + }; + withMountedFile = (path, source) => { + const ctx = this._ctx.select("withMountedFile", { path, source }); + return new Workspace(ctx); + }; withNewDirectory = (path, source) => { const ctx = this._ctx.select("withNewDirectory", { path, source }); return new Workspace(ctx); @@ -105580,6 +106744,14 @@ class Workspace extends BaseClient { const ctx = this._ctx.select("withoutConfigValue", { key, ...opts }); return new Workspace(ctx); }; + withoutDirectory = (path) => { + const ctx = this._ctx.select("withoutDirectory", { path }); + return new Workspace(ctx); + }; + withoutFile = (path) => { + const ctx = this._ctx.select("withoutFile", { path }); + return new Workspace(ctx); + }; withoutModule = (name, opts) => { const ctx = this._ctx.select("withoutModule", { name, ...opts }); return new Workspace(ctx); @@ -105866,7 +107038,7 @@ var opentelemetry2 = __toESM(require_src(), 1); // src/telemetry/init.ts var import_core2 = __toESM(require_src3(), 1); var import_exporter_trace_otlp_proto = __toESM(require_src9(), 1); -var import_sdk_node = __toESM(require_src33(), 1); +var import_sdk_node = __toESM(require_src34(), 1); var import_sdk_trace_base2 = __toESM(require_src12(), 1); // src/telemetry/live_processor.ts @@ -106480,6 +107652,9 @@ class Registry { up = () => { return (target, propertyKey, descriptor) => descriptor; }; + agent = () => { + return (target, propertyKey, descriptor) => {}; + }; argument = (opts) => { return (target, propertyKey, parameterIndex) => {}; }; @@ -106516,6 +107691,7 @@ var func = registry.func; var check = registry.check; var generate = registry.generate; var up = registry.up; +var agent = registry.agent; var field = registry.field; var enumType = registry.enumType; var argument = registry.argument; @@ -106526,6 +107702,7 @@ var FUNCTION_DECORATOR = func.name; var CHECK_DECORATOR = check.name; var GENERATOR_DECORATOR = generate.name; var UP_DECORATOR = up.name; +var AGENT_DECORATOR = agent.name; var FIELD_DECORATOR = field.name; var ARGUMENT_DECORATOR = argument.name; var ENUM_DECORATOR = enumType.name; @@ -106835,6 +108012,7 @@ class DaggerFunction extends Locatable { isCheck = false; isGenerator = false; isUp = false; + isAgent = false; signature; symbol; constructor(node, ast2) { @@ -106865,6 +108043,9 @@ class DaggerFunction extends Locatable { if (this.ast.isNodeDecoratedWith(this.node, UP_DECORATOR)) { this.isUp = true; } + if (this.ast.isNodeDecoratedWith(this.node, AGENT_DECORATOR)) { + this.isAgent = true; + } for (const parameter of this.node.parameters) { this.arguments[parameter.name.getText()] = new DaggerArgument(parameter, this.ast); } @@ -108048,6 +109229,7 @@ function serializeFunction(fn) { isCheck: f4.isCheck === true, isGenerator: f4.isGenerator === true, isUp: f4.isUp === true, + isAgent: f4.isAgent === true, location: f4.getLocation(), returnType: f4.returnType ? serializeType(f4.returnType) : undefined, arguments: Object.values(f4.arguments).map(serializeArgument) @@ -108223,6 +109405,9 @@ class Register { if (fct.isUp) { fnDef = fnDef.withUp(); } + if (fct.isAgent) { + fnDef = fnDef.withAgent(); + } return fnDef; } addArg(args) { diff --git a/library/package.json b/library/package.json index 212597a..43e4242 100644 --- a/library/package.json +++ b/library/package.json @@ -1,7 +1,7 @@ { "name": "@dagger.io/dagger", - "version": "1.0.0", - "author": "dagger.io", + "version": "0.0.0", + "author": "hello@dagger.io", "license": "Apache-2.0", "types": "./dist/src/index.d.ts", "type": "module", @@ -26,7 +26,7 @@ "@opentelemetry/sdk-metrics": "^2.8.0", "@opentelemetry/sdk-node": "^0.219.0", "@opentelemetry/semantic-conventions": "^1.41.1", - "adm-zip": "^0.5.18", + "adm-zip": "^0.6.0", "env-paths": "^4.0.0", "execa": "^9.6.1", "graphql": "^17.0.1", @@ -39,13 +39,12 @@ "typescript": "^6.0.3" }, "resolutions": { + "@grpc/grpc-js": "1.14.4", "**/@grpc/proto-loader/protobufjs": "7.6.1", "**/@opentelemetry/otlp-transformer/protobufjs": "8.4.1", + "@opentelemetry/propagator-jaeger": "2.9.0", "**/glob/minimatch": "9.0.9", - "@grpc/grpc-js": "1.14.4", - "form-data": "4.0.6", - "mocha/minimatch": "9.0.9", - "mocha/serialize-javascript": "7.0.3" + "form-data": "4.0.6" }, "devDependencies": { "@types/adm-zip": "^0.5.8", diff --git a/library/src/api/client.gen.ts b/library/src/api/client.gen.ts index 778c640..087b20f 100644 --- a/library/src/api/client.gen.ts +++ b/library/src/api/client.gen.ts @@ -32,6 +32,13 @@ export type AddressFileOpts = { noCache?: boolean } +export type AgentGroupComposeOpts = { + /** + * The base LLM to compose onto. Defaults to a fresh workspace-bound LLM. + */ + base?: LLM +} + export type BuildArg = { /** * The build argument name. @@ -1009,13 +1016,6 @@ export type ContainerWithoutUnixSocketOpts = { expand?: boolean } -export type CurrentModuleAsSdkOpts = { - /** - * The workspace to resolve SDK-role data against. Defaults to the current workspace. - */ - workspace?: Workspace -} - export type CurrentModuleGeneratorsOpts = { /** * Only include generators matching the specified patterns @@ -1370,13 +1370,27 @@ export type DirectoryWithNewFileOpts = { permissions?: number } +export type DirectoryWithPatchOpts = { + /** + * How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + */ + onConflict?: PatchConflict +} + +export type DirectoryWithPatchFileOpts = { + /** + * How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + */ + onConflict?: PatchConflict +} + export type EngineCacheEntrySetOpts = { key?: string } export type EngineCachePruneOpts = { /** - * Use the engine-wide default pruning policy if true, otherwise prune the whole cache of any releasable entries. + * Use enabled engine-wide default disk and structural policies. If no default disk policy is enabled, the disk stage falls back to pruning all releasable disk-cache entries. If false, explicit options select stages; with no options, all releasable disk-cache entries are pruned. */ useDefaultPolicy?: boolean @@ -1399,25 +1413,16 @@ export type EngineCachePruneOpts = { * Override the target disk space to keep after pruning (e.g. "200GB" or "50%"). */ targetSpace?: string -} - -export type EnvChecksOpts = { - /** - * Only include checks matching the specified patterns - */ - include?: string[] /** - * When true, only return annotated check functions; exclude generate-as-checks + * Override the maximum structural metadata estimate in absolute bytes. Explicit values must be positive; the configured/default value is used when omitted. */ - noGenerate?: boolean -} + maxEstimatedBytes?: number -export type EnvServicesOpts = { /** - * Only include services matching the specified patterns + * Override the structural metadata estimate to target in absolute bytes. Explicit values must be positive and lower than the resolved maximum; the configured/default value is used when omitted. */ - include?: string[] + targetEstimatedBytes?: number } export type EnvFileGetOpts = { @@ -1753,6 +1758,37 @@ export type GeneratorGroupChangesOpts = { onConflict?: ChangesetsMergeConflict } +export type GitCommitAncestorReleaseTagOpts = { + /** + * Include pre-release tags when choosing the latest tag. + */ + includePreRelease?: boolean +} + +export type GitCommitReleaseTagOpts = { + /** + * Include pre-release tags when choosing the latest tag. + */ + includePreRelease?: boolean +} + +export type GitCommitTreeOpts = { + /** + * Set to true to discard .git directory. + */ + discardGitDir?: boolean + + /** + * The depth of the tree to fetch. + */ + depth?: number + + /** + * Set to true to populate tag refs in the local checkout .git. + */ + includeTags?: boolean +} + export type GitRefAsWorkspaceOpts = { /** * Current working directory inside the workspace root. Defaults to the workspace root. @@ -1760,6 +1796,23 @@ export type GitRefAsWorkspaceOpts = { cwd?: string } +export type GitRefLogOpts = { + /** + * Maximum number of commits to return. + */ + limit?: number + + /** + * Only include commits touching these paths, relative to the root of the repository. + */ + paths?: string[] + + /** + * Exclude commits reachable from this ref, i.e. only list commits added on top of it. + */ + base?: GitRef +} + export type GitRefTreeOpts = { /** * Set to true to discard .git directory. @@ -2020,6 +2073,13 @@ export type LLMWithResponseOpts = { totalTokens?: number } +export type LLMWithToolsOpts = { + /** + * Method names to exclude from the toolset (e.g. constructors, entrypoints). + */ + except?: string[] +} + export type LLMContentBlockInput = { /** * The arguments to pass to the tool (for TOOL_CALL kind). @@ -2330,6 +2390,51 @@ export function NetworkProtocolNameToValue(name: string): NetworkProtocol { return name as NetworkProtocol } } +/** + * How to handle patch hunks that no longer apply to the target content. + */ +export enum PatchConflict { + + /** + * Fail the operation if any part of the patch does not apply. + */ + Fail = "FAIL", + + /** + * Apply the hunks that fit and insert conflict markers where hunks no longer match, instead of failing. + */ + LeaveConflictMarkers = "LEAVE_CONFLICT_MARKERS", +} + +/** + * Utility function to convert a PatchConflict value to its name so + * it can be uses as argument to call a exposed function. + */ +export function PatchConflictValueToName(value: PatchConflict): string { + switch (value) { + case PatchConflict.Fail: + return "FAIL" + case PatchConflict.LeaveConflictMarkers: + return "LEAVE_CONFLICT_MARKERS" + default: + return value + } +} + +/** + * Utility function to convert a PatchConflict name to its value so + * it can be properly used inside the module runtime. + */ +export function PatchConflictNameToValue(name: string): PatchConflict { + switch (name) { + case "FAIL": + return PatchConflict.Fail + case "LEAVE_CONFLICT_MARKERS": + return PatchConflict.LeaveConflictMarkers + default: + return name as PatchConflict + } +} export type PipelineLabel = { /** * Label name. @@ -2408,16 +2513,11 @@ export type ClientCurrentTypeDefsOpts = { hideCore?: boolean } -export type ClientEnvOpts = { - /** - * Give the environment the same privileges as the caller: core API including host access, current module, and dependencies - */ - privileged?: boolean - +export type ClientEngineVolumeOpts = { /** - * Allow new outputs to be declared and saved in the environment + * Optional existing subdirectory within the volume payload to mount. */ - writable?: boolean + subdir?: string } export type ClientEnvFileOpts = { @@ -2988,6 +3088,20 @@ export function TypeDefKindNameToValue(name: string): TypeDefKind { */ export type Void = string & {__Void: never} +export type WorkspaceAgentsOpts = { + /** + * Only include agents matching the specified patterns + */ + include?: string[] +} + +export type WorkspaceChangesOpts = { + /** + * An earlier workspace state to compare against. + */ + from?: Workspace +} + export type WorkspaceChecksOpts = { /** * Only include checks matching the specified patterns @@ -3034,6 +3148,23 @@ export type WorkspaceDirectoryOpts = { gitignore?: boolean } +export type WorkspaceFindRootsOpts = { + /** + * Directory to start from. Relative paths resolve from the workspace cwd. + */ + start?: string + + /** + * File basenames that mark a project root (e.g. ["go.mod"] or ["deno.json", "deno.jsonc"]). + */ + markers: string[] + + /** + * Glob patterns pruning the walk below start (e.g. ["**\/node_modules/**"]). + */ + exclude?: string[] +} + export type WorkspaceFindUpOpts = { /** * Path to start the search from. Relative paths resolve from the workspace cwd; absolute paths resolve from the workspace root. @@ -3141,11 +3272,16 @@ export type WorkspaceWithInitClientOpts = { * Write to the workspace config directory at the workspace cwd. */ here?: boolean + + /** + * Skip running the SDK's generators for the new client. + */ + noGenerate?: boolean } export type WorkspaceWithInitModuleOpts = { /** - * Workspace-relative path for the new module. + * Path for the new module, relative to the workspace cwd; a leading "/" is relative to the workspace root. Defaults to .dagger/modules/ beside the workspace config. */ path?: string @@ -3168,6 +3304,11 @@ export type WorkspaceWithInitModuleOpts = { * Write to the workspace config directory at the workspace cwd. */ here?: boolean + + /** + * Skip running the SDK's generators for the new module. + */ + noGenerate?: boolean } export type WorkspaceWithModuleOpts = { @@ -3415,13 +3556,10 @@ export class Address extends BaseClient { } -export class Binding extends BaseClient { +export class Agent extends BaseClient { private readonly _id?: ID = undefined - private readonly _asString?: string = undefined - private readonly _digest?: string = undefined - private readonly _isNull?: boolean = undefined + private readonly _description?: string = undefined private readonly _name?: string = undefined - private readonly _typeName?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -3429,24 +3567,18 @@ export class Binding extends BaseClient { constructor( ctx?: Context, _id?: ID, - _asString?: string, - _digest?: string, - _isNull?: boolean, + _description?: string, _name?: string, - _typeName?: string, ) { super(ctx) this._id = _id - this._asString = _asString - this._digest = _digest - this._isNull = _isNull + this._description = _description this._name = _name - this._typeName = _typeName } /** - * A unique identifier for this Binding. + * A unique identifier for this Agent. */ id = async (): Promise => { if (this._id) { @@ -3464,542 +3596,495 @@ export class Binding extends BaseClient { } /** - * Retrieve the binding value, as type Address + * The description of the agent */ - asAddress = (): Address => { + description = async (): Promise => { + if (this._description) { + return this._description + } const ctx = this._ctx.select( - "asAddress", + "description", ) - return new Address(ctx) - } - /** - * Retrieve the binding value, as type CacheVolume - */ - asCacheVolume = (): CacheVolume => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asCacheVolume", - ) - return new CacheVolume(ctx) + + return response } /** - * Retrieve the binding value, as type Changeset + * Return the fully qualified name of the agent */ - asChangeset = (): Changeset => { + name = async (): Promise => { + if (this._name) { + return this._name + } const ctx = this._ctx.select( - "asChangeset", + "name", ) - return new Changeset(ctx) - } - /** - * Retrieve the binding value, as type Check - */ - asCheck = (): Check => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asCheck", - ) - return new Check(ctx) + + return response } /** - * Retrieve the binding value, as type CheckGroup + * The original module in which the agent has been defined */ - asCheckGroup = (): CheckGroup => { + originalModule = (): Module_ => { const ctx = this._ctx.select( - "asCheckGroup", + "originalModule", ) - return new CheckGroup(ctx) + return new Module_(ctx) } /** - * Retrieve the binding value, as type Cloud + * The path of the agent within its module */ - asCloud = (): Cloud => { - + path = async (): Promise => { const ctx = this._ctx.select( - "asCloud", + "path", ) - return new Cloud(ctx) - } - /** - * Retrieve the binding value, as type Container - */ - asContainer = (): Container => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asContainer", - ) - return new Container(ctx) + + return response } +} - /** - * Retrieve the binding value, as type CurrentModuleAsSDK - */ - asCurrentModuleAsSDK = (): CurrentModuleAsSDK => { - const ctx = this._ctx.select( - "asCurrentModuleAsSDK", - ) - return new CurrentModuleAsSDK(ctx) - } +export class AgentGroup extends BaseClient { + private readonly _id?: ID = undefined /** - * Retrieve the binding value, as type CurrentModuleAsSDKClient + * Constructor is used for internal usage only, do not create object from it. */ - asCurrentModuleAsSDKClient = (): CurrentModuleAsSDKClient => { + constructor( + ctx?: Context, + _id?: ID, + ) { + super(ctx) - const ctx = this._ctx.select( - "asCurrentModuleAsSDKClient", - ) - return new CurrentModuleAsSDKClient(ctx) - } + this._id = _id + } /** - * Retrieve the binding value, as type CurrentModuleAsSDKModule + * A unique identifier for this AgentGroup. */ - asCurrentModuleAsSDKModule = (): CurrentModuleAsSDKModule => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "asCurrentModuleAsSDKModule", + "id", ) - return new CurrentModuleAsSDKModule(ctx) - } - /** - * Retrieve the binding value, as type DiffStat - */ - asDiffStat = (): DiffStat => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asDiffStat", - ) - return new DiffStat(ctx) + + return response } /** - * Retrieve the binding value, as type Directory + * Compose all selected agent middlewares onto a base LLM, in alphabetical module:fn order, and return the composed LLM. + * @param opts.base The base LLM to compose onto. Defaults to a fresh workspace-bound LLM. */ - asDirectory = (): Directory => { + compose = (opts?: AgentGroupComposeOpts): LLM => { const ctx = this._ctx.select( - "asDirectory", + "compose", + { ...opts }, ) - return new Directory(ctx) + return new LLM(ctx) } /** - * Retrieve the binding value, as type Env + * Return a list of individual agents and their details */ - asEnv = (): Env => { + list = async (): Promise => { + type list = { + id: ID + } const ctx = this._ctx.select( - "asEnv", - ) - return new Env(ctx) - } + "list", + ).select("id") - /** - * Retrieve the binding value, as type EnvFile - */ - asEnvFile = (): EnvFile => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asEnvFile", - ) - return new EnvFile(ctx) + + return response.map((r) => new Agent(ctx.copy().selectNode(r.id, "Agent"))) } +} - /** - * Retrieve the binding value, as type File - */ - asFile = (): File => { - const ctx = this._ctx.select( - "asFile", - ) - return new File(ctx) - } - /** - * Retrieve the binding value, as type Generator - */ - asGenerator = (): Generator => { - const ctx = this._ctx.select( - "asGenerator", - ) - return new Generator(ctx) - } - /** - * Retrieve the binding value, as type GeneratorGroup - */ - asGeneratorGroup = (): GeneratorGroup => { - const ctx = this._ctx.select( - "asGeneratorGroup", - ) - return new GeneratorGroup(ctx) - } - - /** - * Retrieve the binding value, as type GitRef - */ - asGitRef = (): GitRef => { - const ctx = this._ctx.select( - "asGitRef", - ) - return new GitRef(ctx) - } +/** + * A directory whose contents persist across runs. + */ +export class CacheVolume extends BaseClient { + private readonly _id?: ID = undefined /** - * Retrieve the binding value, as type GitRepository + * Constructor is used for internal usage only, do not create object from it. */ - asGitRepository = (): GitRepository => { + constructor( + ctx?: Context, + _id?: ID, + ) { + super(ctx) - const ctx = this._ctx.select( - "asGitRepository", - ) - return new GitRepository(ctx) - } + this._id = _id + } /** - * Retrieve the binding value, as type HTTPState + * A unique identifier for this CacheVolume. */ - asHTTPState = (): HTTPState => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "asHTTPState", + "id", ) - return new HTTPState(ctx) - } - /** - * Retrieve the binding value, as type JSONValue - */ - asJSONValue = (): JSONValue => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asJSONValue", - ) - return new JSONValue(ctx) + + return response } +} + +/** + * A comparison between two directories representing changes that can be applied. + */ +export class Changeset extends BaseClient { + private readonly _id?: ID = undefined + private readonly _export?: string = undefined + private readonly _isEmpty?: boolean = undefined + private readonly _sync?: ID = undefined /** - * Retrieve the binding value, as type LLMContentBlock + * Constructor is used for internal usage only, do not create object from it. */ - asLLMContentBlock = (): LLMContentBlock => { + constructor( + ctx?: Context, + _id?: ID, + _export?: string, + _isEmpty?: boolean, + _sync?: ID, + ) { + super(ctx) - const ctx = this._ctx.select( - "asLLMContentBlock", - ) - return new LLMContentBlock(ctx) - } + this._id = _id + this._export = _export + this._isEmpty = _isEmpty + this._sync = _sync + } /** - * Retrieve the binding value, as type LLMMessage + * A unique identifier for this Changeset. */ - asLLMMessage = (): LLMMessage => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "asLLMMessage", + "id", ) - return new LLMMessage(ctx) - } - /** - * Retrieve the binding value, as type Module - */ - asModule = (): Module_ => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asModule", - ) - return new Module_(ctx) + + return response } /** - * Retrieve the binding value, as type ModuleConfigClient + * Files and directories that were added in the newer directory. */ - asModuleConfigClient = (): ModuleConfigClient => { - + addedPaths = async (): Promise => { const ctx = this._ctx.select( - "asModuleConfigClient", + "addedPaths", ) - return new ModuleConfigClient(ctx) - } - /** - * Retrieve the binding value, as type ModuleSource - */ - asModuleSource = (): ModuleSource => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asModuleSource", - ) - return new ModuleSource(ctx) + + return response } /** - * Retrieve the binding value, as type Schema + * The newer/upper snapshot. */ - asSchema = (): Schema => { + after = (): Directory => { const ctx = this._ctx.select( - "asSchema", + "after", ) - return new Schema(ctx) + return new Directory(ctx) } /** - * Retrieve the binding value, as type SearchResult + * Return a Git-compatible patch of the changes */ - asSearchResult = (): SearchResult => { + asPatch = (): File => { const ctx = this._ctx.select( - "asSearchResult", + "asPatch", ) - return new SearchResult(ctx) + return new File(ctx) } /** - * Retrieve the binding value, as type SearchSubmatch + * The older/lower snapshot to compare against. */ - asSearchSubmatch = (): SearchSubmatch => { + before = (): Directory => { const ctx = this._ctx.select( - "asSearchSubmatch", + "before", ) - return new SearchSubmatch(ctx) + return new Directory(ctx) } /** - * Retrieve the binding value, as type Secret + * Structured per-path diff statistics (kind and line counts) for this changeset. */ - asSecret = (): Secret => { + diffStats = async (): Promise => { + type diffStats = { + id: ID + } const ctx = this._ctx.select( - "asSecret", - ) - return new Secret(ctx) - } + "diffStats", + ).select("id") - /** - * Retrieve the binding value, as type Service - */ - asService = (): Service => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asService", - ) - return new Service(ctx) + + return response.map((r) => new DiffStat(ctx.copy().selectNode(r.id, "DiffStat"))) } /** - * Retrieve the binding value, as type Socket + * Applies the diff represented by this changeset to a path on the host. + * @param path Location of the copied directory (e.g., "logs/"). */ - asSocket = (): Socket => { + export = async (path: string): Promise => { + if (this._export) { + return this._export + } const ctx = this._ctx.select( - "asSocket", + "export", + { path}, ) - return new Socket(ctx) - } - /** - * Retrieve the binding value, as type Stat - */ - asStat = (): Stat => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asStat", - ) - return new Stat(ctx) + + return response } /** - * Returns the binding's string value + * Returns true if the changeset is empty (i.e. there are no changes). */ - asString = async (): Promise => { - if (this._asString) { - return this._asString + isEmpty = async (): Promise => { + if (this._isEmpty) { + return this._isEmpty } const ctx = this._ctx.select( - "asString", + "isEmpty", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Retrieve the binding value, as type Up + * Return a snapshot containing only the created and modified files */ - asUp = (): Up => { + layer = (): Directory => { const ctx = this._ctx.select( - "asUp", + "layer", ) - return new Up(ctx) + return new Directory(ctx) } /** - * Retrieve the binding value, as type UpGroup + * Files and directories that existed before and were updated in the newer directory. */ - asUpGroup = (): UpGroup => { - + modifiedPaths = async (): Promise => { const ctx = this._ctx.select( - "asUpGroup", + "modifiedPaths", ) - return new UpGroup(ctx) - } - /** - * Retrieve the binding value, as type Volume - */ - asVolume = (): Volume => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asVolume", - ) - return new Volume(ctx) + + return response } /** - * Retrieve the binding value, as type Workspace + * Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included. */ - asWorkspace = (): Workspace => { - + removedPaths = async (): Promise => { const ctx = this._ctx.select( - "asWorkspace", + "removedPaths", ) - return new Workspace(ctx) - } - /** - * Retrieve the binding value, as type WorkspaceGit - */ - asWorkspaceGit = (): WorkspaceGit => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asWorkspaceGit", - ) - return new WorkspaceGit(ctx) + + return response } /** - * Retrieve the binding value, as type WorkspaceMigration + * Force evaluation in the engine. */ - asWorkspaceMigration = (): WorkspaceMigration => { - + sync = async (): Promise => { const ctx = this._ctx.select( - "asWorkspaceMigration", + "sync", ) - return new WorkspaceMigration(ctx) - } - /** - * Retrieve the binding value, as type WorkspaceMigrationStep - */ - asWorkspaceMigrationStep = (): WorkspaceMigrationStep => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asWorkspaceMigrationStep", - ) - return new WorkspaceMigrationStep(ctx) + + return new Changeset(ctx.copy().selectNode(response, "Changeset")) } /** - * Retrieve the binding value, as type WorkspaceModule + * Add changes to an existing changeset + * + * By default the operation will fail in case of conflicts, for instance a file modified in both changesets. The behavior can be adjusted using onConflict argument + * @param changes Changes to merge into the actual changeset + * @param opts.onConflict What to do on a merge conflict */ - asWorkspaceModule = (): WorkspaceModule => { + withChangeset = (changes: Changeset, opts?: ChangesetWithChangesetOpts): Changeset => { + const metadata = { + onConflict: { is_enum: true, value_to_name: ChangesetMergeConflictValueToName }, + } + const ctx = this._ctx.select( - "asWorkspaceModule", + "withChangeset", + { changes, ...opts, __metadata: metadata }, ) - return new WorkspaceModule(ctx) + return new Changeset(ctx) } /** - * Retrieve the binding value, as type WorkspaceModuleSetting + * Add changes from multiple changesets using git octopus merge strategy + * + * This is more efficient than chaining multiple withChangeset calls when merging many changesets. + * + * Only FAIL and FAIL_EARLY conflict strategies are supported (octopus merge cannot use -X ours/theirs). + * @param changes List of changesets to merge into the actual changeset + * @param opts.onConflict What to do on a merge conflict */ - asWorkspaceModuleSetting = (): WorkspaceModuleSetting => { + withChangesets = (changes: Changeset[], opts?: ChangesetWithChangesetsOpts): Changeset => { + const metadata = { + onConflict: { is_enum: true, value_to_name: ChangesetsMergeConflictValueToName }, + } + const ctx = this._ctx.select( - "asWorkspaceModuleSetting", + "withChangesets", + { changes, ...opts, __metadata: metadata }, ) - return new WorkspaceModuleSetting(ctx) + return new Changeset(ctx) } /** - * Retrieve the binding value, as type WorkspaceSDK + * Call the provided function with current Changeset. + * + * This is useful for reusability and readability by not breaking the calling chain. */ - asWorkspaceSDK = (): WorkspaceSDK => { - - const ctx = this._ctx.select( - "asWorkspaceSDK", - ) - return new WorkspaceSDK(ctx) + with = (arg: (param: Changeset) => Changeset) => { + return arg(this) } +} - /** - * Returns the digest of the binding value - */ - digest = async (): Promise => { - if (this._digest) { - return this._digest - } - const ctx = this._ctx.select( - "digest", - ) - const response: Awaited = await ctx.execute() - - return response - } + + +export class Check extends BaseClient { + private readonly _id?: ID = undefined + private readonly _checkType?: string = undefined + private readonly _completed?: boolean = undefined + private readonly _description?: string = undefined + private readonly _name?: string = undefined + private readonly _passed?: boolean = undefined + private readonly _resultEmoji?: string = undefined + + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor( + ctx?: Context, + _id?: ID, + _checkType?: string, + _completed?: boolean, + _description?: string, + _name?: string, + _passed?: boolean, + _resultEmoji?: string, + ) { + super(ctx) + + this._id = _id + this._checkType = _checkType + this._completed = _completed + this._description = _description + this._name = _name + this._passed = _passed + this._resultEmoji = _resultEmoji + } /** - * Returns true if the binding is null + * A unique identifier for this Check. */ - isNull = async (): Promise => { - if (this._isNull) { - return this._isNull + id = async (): Promise => { + if (this._id) { + return this._id } const ctx = this._ctx.select( - "isNull", + "id", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Returns the binding name + * The type of check: 'check' for annotated checks, 'generate' for generate-as-checks */ - name = async (): Promise => { - if (this._name) { - return this._name + checkType = async (): Promise => { + if (this._checkType) { + return this._checkType } const ctx = this._ctx.select( - "name", + "checkType", ) const response: Awaited = await ctx.execute() @@ -4009,118 +4094,110 @@ export class Binding extends BaseClient { } /** - * Returns the binding type + * Whether the check completed */ - typeName = async (): Promise => { - if (this._typeName) { - return this._typeName + completed = async (): Promise => { + if (this._completed) { + return this._completed } const ctx = this._ctx.select( - "typeName", + "completed", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } -} - - - + /** + * The description of the check + */ + description = async (): Promise => { + if (this._description) { + return this._description + } + const ctx = this._ctx.select( + "description", + ) + const response: Awaited = await ctx.execute() -/** - * A directory whose contents persist across runs. - */ -export class CacheVolume extends BaseClient { - private readonly _id?: ID = undefined + + return response + } /** - * Constructor is used for internal usage only, do not create object from it. + * If the check failed, this is the error */ - constructor( - ctx?: Context, - _id?: ID, - ) { - super(ctx) + error = async (): Promise => { + const ctx = this._ctx.select( + "error", + ).select("id") - this._id = _id - } + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Error(ctx.copy().selectNode(response, "Error")) + } /** - * A unique identifier for this CacheVolume. + * Return the fully qualified name of the check */ - id = async (): Promise => { - if (this._id) { - return this._id + name = async (): Promise => { + if (this._name) { + return this._name } const ctx = this._ctx.select( - "id", + "name", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } -} - -/** - * A comparison between two directories representing changes that can be applied. - */ -export class Changeset extends BaseClient { - private readonly _id?: ID = undefined - private readonly _export?: string = undefined - private readonly _isEmpty?: boolean = undefined - private readonly _sync?: ID = undefined /** - * Constructor is used for internal usage only, do not create object from it. + * The original module in which the check has been defined */ - constructor( - ctx?: Context, - _id?: ID, - _export?: string, - _isEmpty?: boolean, - _sync?: ID, - ) { - super(ctx) + originalModule = (): Module_ => { - this._id = _id - this._export = _export - this._isEmpty = _isEmpty - this._sync = _sync - } + const ctx = this._ctx.select( + "originalModule", + ) + return new Module_(ctx) + } /** - * A unique identifier for this Changeset. + * Whether the check passed */ - id = async (): Promise => { - if (this._id) { - return this._id + passed = async (): Promise => { + if (this._passed) { + return this._passed } const ctx = this._ctx.select( - "id", + "passed", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Files and directories that were added in the newer directory. + * The path of the check within its module */ - addedPaths = async (): Promise => { + path = async (): Promise => { const ctx = this._ctx.select( - "addedPaths", + "path", ) const response: Awaited = await ctx.execute() @@ -4130,212 +4207,135 @@ export class Changeset extends BaseClient { } /** - * The newer/upper snapshot. + * An emoji representing the result of the check */ - after = (): Directory => { + resultEmoji = async (): Promise => { + if (this._resultEmoji) { + return this._resultEmoji + } const ctx = this._ctx.select( - "after", + "resultEmoji", ) - return new Directory(ctx) - } - /** - * Return a Git-compatible patch of the changes - */ - asPatch = (): File => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "asPatch", - ) - return new File(ctx) + + return response } /** - * The older/lower snapshot to compare against. + * Execute the check */ - before = (): Directory => { + run = (): Check => { const ctx = this._ctx.select( - "before", + "run", ) - return new Directory(ctx) + return new Check(ctx) } /** - * Structured per-path diff statistics (kind and line counts) for this changeset. + * Call the provided function with current Check. + * + * This is useful for reusability and readability by not breaking the calling chain. */ - diffStats = async (): Promise => { - type diffStats = { - id: ID - } + with = (arg: (param: Check) => Check) => { + return arg(this) + } +} - const ctx = this._ctx.select( - "diffStats", - ).select("id") - const response: Awaited = await ctx.execute() +export class CheckGroup extends BaseClient { + private readonly _id?: ID = undefined - - return response.map((r) => new DiffStat(ctx.copy().selectNode(r.id, "DiffStat"))) - } + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor( + ctx?: Context, + _id?: ID, + ) { + super(ctx) + + this._id = _id + } /** - * Applies the diff represented by this changeset to a path on the host. - * @param path Location of the copied directory (e.g., "logs/"). + * A unique identifier for this CheckGroup. */ - export = async (path: string): Promise => { - if (this._export) { - return this._export + id = async (): Promise => { + if (this._id) { + return this._id } const ctx = this._ctx.select( - "export", - { path}, + "id", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Returns true if the changeset is empty (i.e. there are no changes). + * Return a list of individual checks and their details */ - isEmpty = async (): Promise => { - if (this._isEmpty) { - return this._isEmpty + list = async (): Promise => { + type list = { + id: ID } const ctx = this._ctx.select( - "isEmpty", - ) + "list", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new Check(ctx.copy().selectNode(r.id, "Check"))) } /** - * Return a snapshot containing only the created and modified files + * Generate a markdown report */ - layer = (): Directory => { + report = (): File => { const ctx = this._ctx.select( - "layer", + "report", ) - return new Directory(ctx) - } - - /** - * Files and directories that existed before and were updated in the newer directory. - */ - modifiedPaths = async (): Promise => { - const ctx = this._ctx.select( - "modifiedPaths", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included. - */ - removedPaths = async (): Promise => { - const ctx = this._ctx.select( - "removedPaths", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Force evaluation in the engine. - */ - sync = async (): Promise => { - const ctx = this._ctx.select( - "sync", - ) - - const response: Awaited = await ctx.execute() - - - return new Changeset(ctx.copy().selectNode(response, "Changeset")) - } - - /** - * Add changes to an existing changeset - * - * By default the operation will fail in case of conflicts, for instance a file modified in both changesets. The behavior can be adjusted using onConflict argument - * @param changes Changes to merge into the actual changeset - * @param opts.onConflict What to do on a merge conflict - */ - withChangeset = (changes: Changeset, opts?: ChangesetWithChangesetOpts): Changeset => { - const metadata = { - onConflict: { is_enum: true, value_to_name: ChangesetMergeConflictValueToName }, - } - - - const ctx = this._ctx.select( - "withChangeset", - { changes, ...opts, __metadata: metadata }, - ) - return new Changeset(ctx) + return new File(ctx) } /** - * Add changes from multiple changesets using git octopus merge strategy - * - * This is more efficient than chaining multiple withChangeset calls when merging many changesets. - * - * Only FAIL and FAIL_EARLY conflict strategies are supported (octopus merge cannot use -X ours/theirs). - * @param changes List of changesets to merge into the actual changeset - * @param opts.onConflict What to do on a merge conflict + * Execute all selected checks + * @param opts.failFast If true, stop running checks as soon as any check fails. */ - withChangesets = (changes: Changeset[], opts?: ChangesetWithChangesetsOpts): Changeset => { - const metadata = { - onConflict: { is_enum: true, value_to_name: ChangesetsMergeConflictValueToName }, - } - + run = (opts?: CheckGroupRunOpts): CheckGroup => { const ctx = this._ctx.select( - "withChangesets", - { changes, ...opts, __metadata: metadata }, + "run", + { ...opts }, ) - return new Changeset(ctx) + return new CheckGroup(ctx) } /** - * Call the provided function with current Changeset. + * Call the provided function with current CheckGroup. * * This is useful for reusability and readability by not breaking the calling chain. */ - with = (arg: (param: Changeset) => Changeset) => { + with = (arg: (param: CheckGroup) => CheckGroup) => { return arg(this) } } - - - - - -export class Check extends BaseClient { +/** + * An internal persistent filesync mirror. + */ +export class ClientFilesyncMirror extends BaseClient { private readonly _id?: ID = undefined - private readonly _checkType?: string = undefined - private readonly _completed?: boolean = undefined - private readonly _description?: string = undefined - private readonly _name?: string = undefined - private readonly _passed?: boolean = undefined - private readonly _resultEmoji?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -4343,26 +4343,14 @@ export class Check extends BaseClient { constructor( ctx?: Context, _id?: ID, - _checkType?: string, - _completed?: boolean, - _description?: string, - _name?: string, - _passed?: boolean, - _resultEmoji?: string, ) { super(ctx) this._id = _id - this._checkType = _checkType - this._completed = _completed - this._description = _description - this._name = _name - this._passed = _passed - this._resultEmoji = _resultEmoji } /** - * A unique identifier for this Check. + * A unique identifier for this ClientFilesyncMirror. */ id = async (): Promise => { if (this._id) { @@ -4378,53 +4366,57 @@ export class Check extends BaseClient { return response } +} + +/** + * Dagger Cloud configuration and state + */ +export class Cloud extends BaseClient { + private readonly _id?: ID = undefined + private readonly _traceURL?: string = undefined /** - * The type of check: 'check' for annotated checks, 'generate' for generate-as-checks + * Constructor is used for internal usage only, do not create object from it. */ - checkType = async (): Promise => { - if (this._checkType) { - return this._checkType - } - - const ctx = this._ctx.select( - "checkType", - ) - - const response: Awaited = await ctx.execute() + constructor( + ctx?: Context, + _id?: ID, + _traceURL?: string, + ) { + super(ctx) - - return response - } + this._id = _id + this._traceURL = _traceURL + } /** - * Whether the check completed + * A unique identifier for this Cloud. */ - completed = async (): Promise => { - if (this._completed) { - return this._completed + id = async (): Promise => { + if (this._id) { + return this._id } const ctx = this._ctx.select( - "completed", + "id", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The description of the check + * The trace URL for the current session */ - description = async (): Promise => { - if (this._description) { - return this._description + traceURL = async (): Promise => { + if (this._traceURL) { + return this._traceURL } const ctx = this._ctx.select( - "description", + "traceURL", ) const response: Awaited = await ctx.execute() @@ -4432,445 +4424,484 @@ export class Check extends BaseClient { return response } +} + +/** + * An OCI-compatible container, also known as a Docker container. + */ +export class Container extends BaseClient { + private readonly _id?: ID = undefined + private readonly _combinedOutput?: string = undefined + private readonly _envVariable?: string = undefined + private readonly _exists?: boolean = undefined + private readonly _exitCode?: number = undefined + private readonly _export?: string = undefined + private readonly _exportImage?: Void = undefined + private readonly _imageRef?: string = undefined + private readonly _label?: string = undefined + private readonly _platform?: Platform = undefined + private readonly _publish?: string = undefined + private readonly _stderr?: string = undefined + private readonly _stdout?: string = undefined + private readonly _sync?: ID = undefined + private readonly _up?: Void = undefined + private readonly _user?: string = undefined + private readonly _workdir?: string = undefined /** - * If the check failed, this is the error + * Constructor is used for internal usage only, do not create object from it. */ - error = (): Error => { + constructor( + ctx?: Context, + _id?: ID, + _combinedOutput?: string, + _envVariable?: string, + _exists?: boolean, + _exitCode?: number, + _export?: string, + _exportImage?: Void, + _imageRef?: string, + _label?: string, + _platform?: Platform, + _publish?: string, + _stderr?: string, + _stdout?: string, + _sync?: ID, + _up?: Void, + _user?: string, + _workdir?: string, + ) { + super(ctx) - const ctx = this._ctx.select( - "error", - ) - return new Error(ctx) - } + this._id = _id + this._combinedOutput = _combinedOutput + this._envVariable = _envVariable + this._exists = _exists + this._exitCode = _exitCode + this._export = _export + this._exportImage = _exportImage + this._imageRef = _imageRef + this._label = _label + this._platform = _platform + this._publish = _publish + this._stderr = _stderr + this._stdout = _stdout + this._sync = _sync + this._up = _up + this._user = _user + this._workdir = _workdir + } /** - * Return the fully qualified name of the check + * A unique identifier for this Container. */ - name = async (): Promise => { - if (this._name) { - return this._name + id = async (): Promise => { + if (this._id) { + return this._id } const ctx = this._ctx.select( - "name", + "id", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The original module in which the check has been defined - */ - originalModule = (): Module_ => { + * Turn the container into a Service. + * + * Be sure to set any exposed ports before this conversion. + * @param opts.args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]). + * + * If empty, the container's default command is used. + * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args. + * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. + * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. + * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo"). + * @param opts.noInit If set, skip the automatic init process injected into containers by default. + * + * This should only be used if the user requires that their exec process be the pid 1 process in the container. Otherwise it may result in unexpected behavior. + */ + asService = (opts?: ContainerAsServiceOpts): Service => { const ctx = this._ctx.select( - "originalModule", + "asService", + { ...opts }, ) - return new Module_(ctx) + return new Service(ctx) } /** - * Whether the check passed + * Package the container state as an OCI image, and return it as a tar archive + * @param opts.platformVariants Identifiers for other platform specific containers. + * + * Used for multi-platform images. + * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. + * + * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. + * @param opts.mediaTypes Use the specified media types for the image's layers. + * + * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. */ - passed = async (): Promise => { - if (this._passed) { - return this._passed - } + asTarball = (opts?: ContainerAsTarballOpts): File => { + const metadata = { + forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, + mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + } + const ctx = this._ctx.select( - "passed", + "asTarball", + { ...opts, __metadata: metadata }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new File(ctx) } /** - * The path of the check within its module + * The combined buffered standard output and standard error stream of the last executed command + * + * Returns an error if no command was executed */ - path = async (): Promise => { + combinedOutput = async (): Promise => { + if (this._combinedOutput) { + return this._combinedOutput + } + const ctx = this._ctx.select( - "path", + "combinedOutput", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * An emoji representing the result of the check + * Return the container's default arguments. */ - resultEmoji = async (): Promise => { - if (this._resultEmoji) { - return this._resultEmoji - } - + defaultArgs = async (): Promise => { const ctx = this._ctx.select( - "resultEmoji", + "defaultArgs", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Execute the check + * Retrieve a directory from the container's root filesystem + * + * Mounts are included. + * @param path The path of the directory to retrieve (e.g., "./src"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - run = (): Check => { + directory = (path: string, opts?: ContainerDirectoryOpts): Directory => { const ctx = this._ctx.select( - "run", + "directory", + { path, ...opts }, ) - return new Check(ctx) + return new Directory(ctx) } /** - * Call the provided function with current Check. - * - * This is useful for reusability and readability by not breaking the calling chain. + * Retrieves this container's configured docker healthcheck. */ - with = (arg: (param: Check) => Check) => { - return arg(this) - } -} + dockerHealthcheck = async (): Promise => { + const ctx = this._ctx.select( + "dockerHealthcheck", + ).select("id") + const response: Awaited = await ctx.execute() -export class CheckGroup extends BaseClient { - private readonly _id?: ID = undefined + if (response === null) { + return null + } + return new HealthcheckConfig(ctx.copy().selectNode(response, "HealthcheckConfig")) + } /** - * Constructor is used for internal usage only, do not create object from it. + * Return the container's OCI entrypoint. */ - constructor( - ctx?: Context, - _id?: ID, - ) { - super(ctx) + entrypoint = async (): Promise => { + const ctx = this._ctx.select( + "entrypoint", + ) - this._id = _id - } + const response: Awaited = await ctx.execute() + + + return response + } /** - * A unique identifier for this CheckGroup. + * Retrieves the value of the specified persistent environment variable. + * @param name The name of the environment variable to retrieve (e.g., "PATH"). */ - id = async (): Promise => { - if (this._id) { - return this._id + envVariable = async (name: string): Promise => { + if (this._envVariable) { + return this._envVariable } const ctx = this._ctx.select( - "id", + "envVariable", + { name}, ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Return a list of individual checks and their details + * Retrieves the list of persistent environment variables configured on the container. */ - list = async (): Promise => { - type list = { + envVariables = async (): Promise => { + type envVariables = { id: ID } const ctx = this._ctx.select( - "list", + "envVariables", ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new Check(ctx.copy().selectNode(r.id, "Check"))) + return response.map((r) => new EnvVariable(ctx.copy().selectNode(r.id, "EnvVariable"))) } /** - * Generate a markdown report + * check if a file or directory exists + * @param path Path to check (e.g., "/file.txt"). + * @param opts.expectedType If specified, also validate the type of file (e.g. "REGULAR_TYPE", "DIRECTORY_TYPE", or "SYMLINK_TYPE"). + * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - report = (): File => { + exists = async (path: string, + opts?: ContainerExistsOpts): Promise => { + if (this._exists) { + return this._exists + } + + const metadata = { + expectedType: { is_enum: true, value_to_name: ExistsTypeValueToName }, + } const ctx = this._ctx.select( - "report", + "exists", + { path, ...opts, __metadata: metadata}, ) - return new File(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Execute all selected checks - * @param opts.failFast If true, stop running checks as soon as any check fails. + * The exit code of the last executed command + * + * Returns an error if no command was executed */ - run = (opts?: CheckGroupRunOpts): CheckGroup => { + exitCode = async (): Promise => { + if (this._exitCode) { + return this._exitCode + } const ctx = this._ctx.select( - "run", - { ...opts }, + "exitCode", ) - return new CheckGroup(ctx) - } - /** - * Call the provided function with current CheckGroup. - * - * This is useful for reusability and readability by not breaking the calling chain. - */ - with = (arg: (param: CheckGroup) => CheckGroup) => { - return arg(this) - } -} + const response: Awaited = await ctx.execute() -/** - * An internal persistent filesync mirror. - */ -export class ClientFilesyncMirror extends BaseClient { - private readonly _id?: ID = undefined + + return response + } /** - * Constructor is used for internal usage only, do not create object from it. + * EXPERIMENTAL API! Subject to change/removal at any time. + * + * Configures all available GPUs on the host to be accessible to this container. + * + * This currently works for Nvidia devices only. */ - constructor( - ctx?: Context, - _id?: ID, - ) { - super(ctx) + experimentalWithAllGPUs = (): Container => { - this._id = _id - } + const ctx = this._ctx.select( + "experimentalWithAllGPUs", + ) + return new Container(ctx) + } /** - * A unique identifier for this ClientFilesyncMirror. + * EXPERIMENTAL API! Subject to change/removal at any time. + * + * Configures the provided list of devices to be accessible to this container. + * + * This currently works for Nvidia devices only. + * @param devices List of devices to be accessible to this container. */ - id = async (): Promise => { - if (this._id) { - return this._id - } + experimentalWithGPU = (devices: string[]): Container => { const ctx = this._ctx.select( - "id", + "experimentalWithGPU", + { devices }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } -} - -/** - * Dagger Cloud configuration and state - */ -export class Cloud extends BaseClient { - private readonly _id?: ID = undefined - private readonly _traceURL?: string = undefined /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _traceURL?: string, - ) { - super(ctx) - - this._id = _id - this._traceURL = _traceURL - } - - /** - * A unique identifier for this Cloud. + * Writes the container as an OCI tarball to the destination file path on the host. + * + * It can also export platform variants. + * @param path Host's destination path (e.g., "./tarball"). + * + * Path can be relative to the engine's workdir or absolute. + * @param opts.platformVariants Identifiers for other platform specific containers. + * + * Used for multi-platform image. + * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm. + * + * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. + * @param opts.mediaTypes Use the specified media types for the exported image's layers. + * + * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - id = async (): Promise => { - if (this._id) { - return this._id + export = async (path: string, + opts?: ContainerExportOpts): Promise => { + if (this._export) { + return this._export } + const metadata = { + forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, + mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + } + const ctx = this._ctx.select( - "id", + "export", + { path, ...opts, __metadata: metadata}, ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The trace URL for the current session + * Exports the container as an image to the host's container image store. + * @param name Name of image to export to in the host's store + * @param opts.platformVariants Identifiers for other platform specific containers. + * + * Used for multi-platform image. + * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm. + * + * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. + * @param opts.mediaTypes Use the specified media types for the exported image's layers. + * + * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. */ - traceURL = async (): Promise => { - if (this._traceURL) { - return this._traceURL + exportImage = async (name: string, + opts?: ContainerExportImageOpts): Promise => { + if (this._exportImage) { + return } + const metadata = { + forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, + mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + } + const ctx = this._ctx.select( - "traceURL", + "exportImage", + { name, ...opts, __metadata: metadata}, ) - const response: Awaited = await ctx.execute() + await ctx.execute() - return response } -} - -/** - * An OCI-compatible container, also known as a Docker container. - */ -export class Container extends BaseClient { - private readonly _id?: ID = undefined - private readonly _combinedOutput?: string = undefined - private readonly _envVariable?: string = undefined - private readonly _exists?: boolean = undefined - private readonly _exitCode?: number = undefined - private readonly _export?: string = undefined - private readonly _exportImage?: Void = undefined - private readonly _imageRef?: string = undefined - private readonly _label?: string = undefined - private readonly _platform?: Platform = undefined - private readonly _publish?: string = undefined - private readonly _stderr?: string = undefined - private readonly _stdout?: string = undefined - private readonly _sync?: ID = undefined - private readonly _up?: Void = undefined - private readonly _user?: string = undefined - private readonly _workdir?: string = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _combinedOutput?: string, - _envVariable?: string, - _exists?: boolean, - _exitCode?: number, - _export?: string, - _exportImage?: Void, - _imageRef?: string, - _label?: string, - _platform?: Platform, - _publish?: string, - _stderr?: string, - _stdout?: string, - _sync?: ID, - _up?: Void, - _user?: string, - _workdir?: string, - ) { - super(ctx) - - this._id = _id - this._combinedOutput = _combinedOutput - this._envVariable = _envVariable - this._exists = _exists - this._exitCode = _exitCode - this._export = _export - this._exportImage = _exportImage - this._imageRef = _imageRef - this._label = _label - this._platform = _platform - this._publish = _publish - this._stderr = _stderr - this._stdout = _stdout - this._sync = _sync - this._up = _up - this._user = _user - this._workdir = _workdir - } /** - * A unique identifier for this Container. + * Retrieves the list of exposed ports. + * + * This includes ports already exposed by the image, even if not explicitly added with dagger. */ - id = async (): Promise => { - if (this._id) { - return this._id + exposedPorts = async (): Promise => { + type exposedPorts = { + id: ID } const ctx = this._ctx.select( - "id", - ) + "exposedPorts", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new Port(ctx.copy().selectNode(r.id, "Port"))) } /** - * Turn the container into a Service. - * - * Be sure to set any exposed ports before this conversion. - * @param opts.args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]). - * - * If empty, the container's default command is used. - * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args. - * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. - * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - * @param opts.noInit If set, skip the automatic init process injected into containers by default. + * Retrieves a file at the given path. * - * This should only be used if the user requires that their exec process be the pid 1 process in the container. Otherwise it may result in unexpected behavior. + * Mounts are included. + * @param path The path of the file to retrieve (e.g., "./README.md"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). */ - asService = (opts?: ContainerAsServiceOpts): Service => { + file = (path: string, opts?: ContainerFileOpts): File => { const ctx = this._ctx.select( - "asService", - { ...opts }, + "file", + { path, ...opts }, ) - return new Service(ctx) + return new File(ctx) } /** - * Package the container state as an OCI image, and return it as a tar archive - * @param opts.platformVariants Identifiers for other platform specific containers. - * - * Used for multi-platform images. - * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. + * Download a container image, and apply it to the container state. All previous state will be lost. + * @param address Address of the container image to download, in standard OCI ref format. Example:"registry.dagger.io/engine:latest" + * @param opts.registryService Service to use as the registry endpoint for the image address. * - * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Use the specified media types for the image's layers. + * The service will be started only for this pull. + * @param opts.protocol Protocol to use for registry communication. * - * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. + * Defaults to "HTTPS". Use "HTTP" only for plain HTTP registries. + * @param opts.insecureSkipTLSVerify Allow HTTPS registry communication without verifying the server certificate. */ - asTarball = (opts?: ContainerAsTarballOpts): File => { + from = (address: string, opts?: ContainerFromOpts): Container => { const metadata = { - forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, - mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + protocol: { is_enum: true, value_to_name: RegistryProtocolValueToName }, } const ctx = this._ctx.select( - "asTarball", - { ...opts, __metadata: metadata }, + "from", + { address, ...opts, __metadata: metadata }, ) - return new File(ctx) + return new Container(ctx) } /** - * The combined buffered standard output and standard error stream of the last executed command - * - * Returns an error if no command was executed + * The unique image reference which can only be retrieved immediately after the 'Container.From' call. */ - combinedOutput = async (): Promise => { - if (this._combinedOutput) { - return this._combinedOutput + imageRef = async (): Promise => { + if (this._imageRef) { + return this._imageRef } const ctx = this._ctx.select( - "combinedOutput", + "imageRef", ) const response: Awaited = await ctx.execute() @@ -4880,210 +4911,171 @@ export class Container extends BaseClient { } /** - * Return the container's default arguments. + * Reads the container from an OCI tarball. + * @param source File to read the container from. + * @param opts.tag Identifies the tag to import from the archive, if the archive bundles multiple tags. */ - defaultArgs = async (): Promise => { + import_ = (source: File, opts?: ContainerImportOpts): Container => { + const ctx = this._ctx.select( - "defaultArgs", + "import", + { source, ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * Retrieve a directory from the container's root filesystem - * - * Mounts are included. - * @param path The path of the directory to retrieve (e.g., "./src"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). + * Retrieves the value of the specified label. + * @param name The name of the label (e.g., "org.opencontainers.artifact.created"). */ - directory = (path: string, opts?: ContainerDirectoryOpts): Directory => { + label = async (name: string): Promise => { + if (this._label) { + return this._label + } const ctx = this._ctx.select( - "directory", - { path, ...opts }, - ) - return new Directory(ctx) - } - - /** - * Retrieves this container's configured docker healthcheck. - */ - dockerHealthcheck = (): HealthcheckConfig => { - - const ctx = this._ctx.select( - "dockerHealthcheck", - ) - return new HealthcheckConfig(ctx) - } - - /** - * Return the container's OCI entrypoint. - */ - entrypoint = async (): Promise => { - const ctx = this._ctx.select( - "entrypoint", + "label", + { name}, ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Retrieves the value of the specified persistent environment variable. - * @param name The name of the environment variable to retrieve (e.g., "PATH"). + * Retrieves the list of labels passed to container. */ - envVariable = async (name: string): Promise => { - if (this._envVariable) { - return this._envVariable + labels = async (): Promise => { + type labels = { + id: ID } const ctx = this._ctx.select( - "envVariable", - { name}, - ) + "labels", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new Label(ctx.copy().selectNode(r.id, "Label"))) } /** - * Retrieves the list of persistent environment variables configured on the container. + * Returns the image layer or configuration blob with the given digest as a File. + * @param id Digest of the layer or configuration blob (e.g. "sha256:abc123..."). + * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. + * + * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. + * @param opts.mediaTypes Media types to use for image layers. Defaults to OCI. */ - envVariables = async (): Promise => { - type envVariables = { - id: ID - } - - const ctx = this._ctx.select( - "envVariables", - ).select("id") + layer = (id: string, opts?: ContainerLayerOpts): File => { + const metadata = { + forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, + mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + } - const response: Awaited = await ctx.execute() - - return response.map((r) => new EnvVariable(ctx.copy().selectNode(r.id, "EnvVariable"))) + const ctx = this._ctx.select( + "layer", + { id, ...opts, __metadata: metadata }, + ) + return new File(ctx) } /** - * check if a file or directory exists - * @param path Path to check (e.g., "/file.txt"). - * @param opts.expectedType If specified, also validate the type of file (e.g. "REGULAR_TYPE", "DIRECTORY_TYPE", or "SYMLINK_TYPE"). - * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). + * Computes and returns the manifest for this container as a File. + * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. + * + * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. + * @param opts.mediaTypes Media types to use for image layers. Defaults to OCI. */ - exists = async (path: string, - opts?: ContainerExistsOpts): Promise => { - if (this._exists) { - return this._exists - } - + manifest = (opts?: ContainerManifestOpts): File => { const metadata = { - expectedType: { is_enum: true, value_to_name: ExistsTypeValueToName }, + forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, + mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, } + const ctx = this._ctx.select( - "exists", - { path, ...opts, __metadata: metadata}, + "manifest", + { ...opts, __metadata: metadata }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new File(ctx) } /** - * The exit code of the last executed command - * - * Returns an error if no command was executed + * Retrieves the list of paths where a directory is mounted. */ - exitCode = async (): Promise => { - if (this._exitCode) { - return this._exitCode - } - + mounts = async (): Promise => { const ctx = this._ctx.select( - "exitCode", + "mounts", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * EXPERIMENTAL API! Subject to change/removal at any time. - * - * Configures all available GPUs on the host to be accessible to this container. - * - * This currently works for Nvidia devices only. + * The platform this container executes and publishes as. */ - experimentalWithAllGPUs = (): Container => { + platform = async (): Promise => { + if (this._platform) { + return this._platform + } const ctx = this._ctx.select( - "experimentalWithAllGPUs", + "platform", ) - return new Container(ctx) - } - /** - * EXPERIMENTAL API! Subject to change/removal at any time. - * - * Configures the provided list of devices to be accessible to this container. - * - * This currently works for Nvidia devices only. - * @param devices List of devices to be accessible to this container. - */ - experimentalWithGPU = (devices: string[]): Container => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "experimentalWithGPU", - { devices }, - ) - return new Container(ctx) + + return response } /** - * Writes the container as an OCI tarball to the destination file path on the host. + * Package the container state as an OCI image, and publish it to a registry * - * It can also export platform variants. - * @param path Host's destination path (e.g., "./tarball"). + * Returns the fully qualified address of the published image, with digest + * @param address The OCI address to publish to * - * Path can be relative to the engine's workdir or absolute. + * Same format as "docker push". Example: "registry.example.com/user/repo:tag" * @param opts.platformVariants Identifiers for other platform specific containers. * * Used for multi-platform image. - * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm. + * @param opts.forcedCompression Force each layer of the published image to use the specified compression algorithm. * * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Use the specified media types for the exported image's layers. + * @param opts.mediaTypes Use the specified media types for the published image's layers. * - * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). + * Defaults to "OCI", which is compatible with most recent registries, but "Docker" may be needed for older registries without OCI support. + * @param opts.registryService Service to use as the registry endpoint for the image address. + * + * The service will be started only for this push. + * @param opts.protocol Protocol to use for registry communication. + * + * Defaults to "HTTPS". Use "HTTP" only for plain HTTP registries. + * @param opts.insecureSkipTLSVerify Allow HTTPS registry communication without verifying the server certificate. */ - export = async (path: string, - opts?: ContainerExportOpts): Promise => { - if (this._export) { - return this._export + publish = async (address: string, + opts?: ContainerPublishOpts): Promise => { + if (this._publish) { + return this._publish } const metadata = { forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, + protocol: { is_enum: true, value_to_name: RegistryProtocolValueToName }, } const ctx = this._ctx.select( - "export", - { path, ...opts, __metadata: metadata}, + "publish", + { address, ...opts, __metadata: metadata}, ) const response: Awaited = await ctx.execute() @@ -5093,537 +5085,257 @@ export class Container extends BaseClient { } /** - * Exports the container as an image to the host's container image store. - * @param name Name of image to export to in the host's store - * @param opts.platformVariants Identifiers for other platform specific containers. - * - * Used for multi-platform image. - * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm. - * - * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Use the specified media types for the exported image's layers. - * - * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support. + * Return a snapshot of the container's root filesystem. The snapshot can be modified then written back using withRootfs. Use that method for filesystem modifications. */ - exportImage = async (name: string, - opts?: ContainerExportImageOpts): Promise => { - if (this._exportImage) { - return - } - - const metadata = { - forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, - mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, - } + rootfs = (): Directory => { const ctx = this._ctx.select( - "exportImage", - { name, ...opts, __metadata: metadata}, + "rootfs", ) + return new Directory(ctx) + } - await ctx.execute() + /** + * Return file status + * @param path Path to check (e.g., "/file.txt"). + * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. + */ + stat = async (path: string, + opts?: ContainerStatOpts): Promise => { + const ctx = this._ctx.select( + "stat", + { path, ...opts}, + ).select("id") - + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Stat(ctx.copy().selectNode(response, "Stat")) } /** - * Retrieves the list of exposed ports. + * The buffered standard error stream of the last executed command * - * This includes ports already exposed by the image, even if not explicitly added with dagger. + * Returns an error if no command was executed */ - exposedPorts = async (): Promise => { - type exposedPorts = { - id: ID + stderr = async (): Promise => { + if (this._stderr) { + return this._stderr } const ctx = this._ctx.select( - "exposedPorts", - ).select("id") + "stderr", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new Port(ctx.copy().selectNode(r.id, "Port"))) + return response } /** - * Retrieves a file at the given path. + * The buffered standard output stream of the last executed command * - * Mounts are included. - * @param path The path of the file to retrieve (e.g., "./README.md"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). + * Returns an error if no command was executed */ - file = (path: string, opts?: ContainerFileOpts): File => { + stdout = async (): Promise => { + if (this._stdout) { + return this._stdout + } const ctx = this._ctx.select( - "file", - { path, ...opts }, + "stdout", ) - return new File(ctx) - } - - /** - * Download a container image, and apply it to the container state. All previous state will be lost. - * @param address Address of the container image to download, in standard OCI ref format. Example:"registry.dagger.io/engine:latest" - * @param opts.registryService Service to use as the registry endpoint for the image address. - * - * The service will be started only for this pull. - * @param opts.protocol Protocol to use for registry communication. - * - * Defaults to "HTTPS". Use "HTTP" only for plain HTTP registries. - * @param opts.insecureSkipTLSVerify Allow HTTPS registry communication without verifying the server certificate. - */ - from = (address: string, opts?: ContainerFromOpts): Container => { - const metadata = { - protocol: { is_enum: true, value_to_name: RegistryProtocolValueToName }, - } + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "from", - { address, ...opts, __metadata: metadata }, - ) - return new Container(ctx) + + return response } /** - * The unique image reference which can only be retrieved immediately after the 'Container.From' call. + * Forces evaluation of the pipeline in the engine. + * + * It doesn't run the default command if no exec has been set. */ - imageRef = async (): Promise => { - if (this._imageRef) { - return this._imageRef - } - + sync = async (): Promise => { const ctx = this._ctx.select( - "imageRef", + "sync", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return new Container(ctx.copy().selectNode(response, "Container")) } /** - * Reads the container from an OCI tarball. - * @param source File to read the container from. - * @param opts.tag Identifies the tag to import from the archive, if the archive bundles multiple tags. + * Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default). + * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead. + * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. + * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. */ - import_ = (source: File, opts?: ContainerImportOpts): Container => { + terminal = (opts?: ContainerTerminalOpts): Container => { const ctx = this._ctx.select( - "import", - { source, ...opts }, + "terminal", + { ...opts }, ) return new Container(ctx) } /** - * Retrieves the value of the specified label. - * @param name The name of the label (e.g., "org.opencontainers.artifact.created"). + * Starts a Service and creates a tunnel that forwards traffic from the caller's network to that service. + * + * Be sure to set any exposed ports before calling this api. + * @param opts.random Bind each tunnel port to a random port on the host. + * @param opts.ports List of frontend/backend port mappings to forward. + * + * Frontend is the port accepting traffic on the host, backend is the service port. + * @param opts.args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]). + * + * If empty, the container's default command is used. + * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args. + * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. + * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. + * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo"). + * @param opts.noInit If set, skip the automatic init process injected into containers by default. + * + * This should only be used if the user requires that their exec process be the pid 1 process in the container. Otherwise it may result in unexpected behavior. */ - label = async (name: string): Promise => { - if (this._label) { - return this._label + up = async ( + opts?: ContainerUpOpts): Promise => { + if (this._up) { + return } const ctx = this._ctx.select( - "label", - { name}, + "up", + { ...opts}, ) - const response: Awaited = await ctx.execute() + await ctx.execute() - return response } /** - * Retrieves the list of labels passed to container. + * Retrieves the user to be set for all commands. */ - labels = async (): Promise => { - type labels = { - id: ID + user = async (): Promise => { + if (this._user) { + return this._user } const ctx = this._ctx.select( - "labels", - ).select("id") + "user", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new Label(ctx.copy().selectNode(r.id, "Label"))) + return response } /** - * Returns the image layer or configuration blob with the given digest as a File. - * @param id Digest of the layer or configuration blob (e.g. "sha256:abc123..."). - * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. - * - * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Media types to use for image layers. Defaults to OCI. + * Retrieves this container plus the given OCI annotation. + * @param name The name of the annotation. + * @param value The value of the annotation. */ - layer = (id: string, opts?: ContainerLayerOpts): File => { - const metadata = { - forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, - mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, - } - + withAnnotation = (name: string, value: string): Container => { const ctx = this._ctx.select( - "layer", - { id, ...opts, __metadata: metadata }, + "withAnnotation", + { name, value }, ) - return new File(ctx) + return new Container(ctx) } /** - * Computes and returns the manifest for this container as a File. - * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm. - * - * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Media types to use for image layers. Defaults to OCI. + * Configures default arguments for future commands. Like CMD in Dockerfile. + * @param args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]). */ - manifest = (opts?: ContainerManifestOpts): File => { - const metadata = { - forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, - mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, - } - - - const ctx = this._ctx.select( - "manifest", - { ...opts, __metadata: metadata }, - ) - return new File(ctx) - } + withDefaultArgs = (args: string[]): Container => { - /** - * Retrieves the list of paths where a directory is mounted. - */ - mounts = async (): Promise => { const ctx = this._ctx.select( - "mounts", + "withDefaultArgs", + { args }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * The platform this container executes and publishes as. + * Set the default command to invoke for the container's terminal API. + * @param args The args of the command. + * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. + * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. */ - platform = async (): Promise => { - if (this._platform) { - return this._platform - } + withDefaultTerminalCmd = (args: string[], opts?: ContainerWithDefaultTerminalCmdOpts): Container => { const ctx = this._ctx.select( - "platform", + "withDefaultTerminalCmd", + { args, ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * Package the container state as an OCI image, and publish it to a registry - * - * Returns the fully qualified address of the published image, with digest - * @param address The OCI address to publish to - * - * Same format as "docker push". Example: "registry.example.com/user/repo:tag" - * @param opts.platformVariants Identifiers for other platform specific containers. - * - * Used for multi-platform image. - * @param opts.forcedCompression Force each layer of the published image to use the specified compression algorithm. - * - * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip. - * @param opts.mediaTypes Use the specified media types for the published image's layers. - * - * Defaults to "OCI", which is compatible with most recent registries, but "Docker" may be needed for older registries without OCI support. - * @param opts.registryService Service to use as the registry endpoint for the image address. + * Return a new container snapshot, with a directory added to its filesystem + * @param path Location of the written directory (e.g., "/tmp/directory"). + * @param source Identifier of the directory to write + * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]). + * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]). + * @param opts.gitignore Apply .gitignore rules when writing the directory. + * @param opts.owner A user:group to set for the directory and its contents. * - * The service will be started only for this push. - * @param opts.protocol Protocol to use for registry communication. + * The user and group can either be an ID (1000:1000) or a name (foo:bar). * - * Defaults to "HTTPS". Use "HTTP" only for plain HTTP registries. - * @param opts.insecureSkipTLSVerify Allow HTTPS registry communication without verifying the server certificate. + * If the group is omitted, it defaults to the same as the user. + * @param opts.inheritOwner Set the owner to the container's current user. + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - publish = async (address: string, - opts?: ContainerPublishOpts): Promise => { - if (this._publish) { - return this._publish - } - - const metadata = { - forcedCompression: { is_enum: true, value_to_name: ImageLayerCompressionValueToName }, - mediaTypes: { is_enum: true, value_to_name: ImageMediaTypesValueToName }, - protocol: { is_enum: true, value_to_name: RegistryProtocolValueToName }, - } + withDirectory = (path: string, source: Directory, opts?: ContainerWithDirectoryOpts): Container => { const ctx = this._ctx.select( - "publish", - { address, ...opts, __metadata: metadata}, + "withDirectory", + { path, source, ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * Return a snapshot of the container's root filesystem. The snapshot can be modified then written back using withRootfs. Use that method for filesystem modifications. + * Retrieves this container with the specificed docker healtcheck command set. + * @param args Healthcheck command to execute. Example: ["go", "run", "main.go"]. + * @param opts.shell When true, command must be a single element, which is run using the container's shell + * @param opts.interval Interval between running healthcheck. Example: "30s" + * @param opts.timeout Healthcheck timeout. Example: "3s" + * @param opts.startPeriod StartPeriod allows for failures during this initial startup period which do not count towards maximum number of retries. Example: "0s" + * @param opts.startInterval StartInterval configures the duration between checks during the startup phase. Example: "5s" + * @param opts.retries The maximum number of consecutive failures before the container is marked as unhealthy. Example: "3" */ - rootfs = (): Directory => { + withDockerHealthcheck = (args: string[], opts?: ContainerWithDockerHealthcheckOpts): Container => { const ctx = this._ctx.select( - "rootfs", + "withDockerHealthcheck", + { args, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return file status - * @param path Path to check (e.g., "/file.txt"). - * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. + * Set an OCI-style entrypoint. It will be included in the container's OCI configuration. Note, withExec ignores the entrypoint by default. + * @param args Arguments of the entrypoint. Example: ["go", "run"]. + * @param opts.keepDefaultArgs Don't reset the default arguments when setting the entrypoint. By default it is reset, since entrypoint and default args are often tightly coupled. */ - stat = (path: string, opts?: ContainerStatOpts): Stat => { + withEntrypoint = (args: string[], opts?: ContainerWithEntrypointOpts): Container => { const ctx = this._ctx.select( - "stat", - { path, ...opts }, + "withEntrypoint", + { args, ...opts }, ) - return new Stat(ctx) - } - - /** - * The buffered standard error stream of the last executed command - * - * Returns an error if no command was executed - */ - stderr = async (): Promise => { - if (this._stderr) { - return this._stderr - } - - const ctx = this._ctx.select( - "stderr", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The buffered standard output stream of the last executed command - * - * Returns an error if no command was executed - */ - stdout = async (): Promise => { - if (this._stdout) { - return this._stdout - } - - const ctx = this._ctx.select( - "stdout", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Forces evaluation of the pipeline in the engine. - * - * It doesn't run the default command if no exec has been set. - */ - sync = async (): Promise => { - const ctx = this._ctx.select( - "sync", - ) - - const response: Awaited = await ctx.execute() - - - return new Container(ctx.copy().selectNode(response, "Container")) - } - - /** - * Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default). - * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead. - * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. - * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - */ - terminal = (opts?: ContainerTerminalOpts): Container => { - - const ctx = this._ctx.select( - "terminal", - { ...opts }, - ) - return new Container(ctx) - } - - /** - * Starts a Service and creates a tunnel that forwards traffic from the caller's network to that service. - * - * Be sure to set any exposed ports before calling this api. - * @param opts.random Bind each tunnel port to a random port on the host. - * @param opts.ports List of frontend/backend port mappings to forward. - * - * Frontend is the port accepting traffic on the host, backend is the service port. - * @param opts.args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]). - * - * If empty, the container's default command is used. - * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args. - * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. - * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - * @param opts.noInit If set, skip the automatic init process injected into containers by default. - * - * This should only be used if the user requires that their exec process be the pid 1 process in the container. Otherwise it may result in unexpected behavior. - */ - up = async ( - opts?: ContainerUpOpts): Promise => { - if (this._up) { - return - } - - const ctx = this._ctx.select( - "up", - { ...opts}, - ) - - await ctx.execute() - - - } - - /** - * Retrieves the user to be set for all commands. - */ - user = async (): Promise => { - if (this._user) { - return this._user - } - - const ctx = this._ctx.select( - "user", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Retrieves this container plus the given OCI annotation. - * @param name The name of the annotation. - * @param value The value of the annotation. - */ - withAnnotation = (name: string, value: string): Container => { - - const ctx = this._ctx.select( - "withAnnotation", - { name, value }, - ) - return new Container(ctx) - } - - /** - * Configures default arguments for future commands. Like CMD in Dockerfile. - * @param args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]). - */ - withDefaultArgs = (args: string[]): Container => { - - const ctx = this._ctx.select( - "withDefaultArgs", - { args }, - ) - return new Container(ctx) - } - - /** - * Set the default command to invoke for the container's terminal API. - * @param args The args of the command. - * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. - * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. - */ - withDefaultTerminalCmd = (args: string[], opts?: ContainerWithDefaultTerminalCmdOpts): Container => { - - const ctx = this._ctx.select( - "withDefaultTerminalCmd", - { args, ...opts }, - ) - return new Container(ctx) - } - - /** - * Return a new container snapshot, with a directory added to its filesystem - * @param path Location of the written directory (e.g., "/tmp/directory"). - * @param source Identifier of the directory to write - * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]). - * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]). - * @param opts.gitignore Apply .gitignore rules when writing the directory. - * @param opts.owner A user:group to set for the directory and its contents. - * - * The user and group can either be an ID (1000:1000) or a name (foo:bar). - * - * If the group is omitted, it defaults to the same as the user. - * @param opts.inheritOwner Set the owner to the container's current user. - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withDirectory = (path: string, source: Directory, opts?: ContainerWithDirectoryOpts): Container => { - - const ctx = this._ctx.select( - "withDirectory", - { path, source, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container with the specificed docker healtcheck command set. - * @param args Healthcheck command to execute. Example: ["go", "run", "main.go"]. - * @param opts.shell When true, command must be a single element, which is run using the container's shell - * @param opts.interval Interval between running healthcheck. Example: "30s" - * @param opts.timeout Healthcheck timeout. Example: "3s" - * @param opts.startPeriod StartPeriod allows for failures during this initial startup period which do not count towards maximum number of retries. Example: "0s" - * @param opts.startInterval StartInterval configures the duration between checks during the startup phase. Example: "5s" - * @param opts.retries The maximum number of consecutive failures before the container is marked as unhealthy. Example: "3" - */ - withDockerHealthcheck = (args: string[], opts?: ContainerWithDockerHealthcheckOpts): Container => { - - const ctx = this._ctx.select( - "withDockerHealthcheck", - { args, ...opts }, - ) - return new Container(ctx) - } - - /** - * Set an OCI-style entrypoint. It will be included in the container's OCI configuration. Note, withExec ignores the entrypoint by default. - * @param args Arguments of the entrypoint. Example: ["go", "run"]. - * @param opts.keepDefaultArgs Don't reset the default arguments when setting the entrypoint. By default it is reset, since entrypoint and default args are often tightly coupled. - */ - withEntrypoint = (args: string[], opts?: ContainerWithEntrypointOpts): Container => { - - const ctx = this._ctx.select( - "withEntrypoint", - { args, ...opts }, - ) - return new Container(ctx) + return new Container(ctx) } /** @@ -5958,1672 +5670,363 @@ export class Container extends BaseClient { const ctx = this._ctx.select( "withRootfs", - { directory }, - ) - return new Container(ctx) - } - - /** - * Set a new environment variable, using a secret value - * @param name Name of the secret variable (e.g., "API_SECRET"). - * @param secret Identifier of the secret value. - */ - withSecretVariable = (name: string, secret: Secret): Container => { - - const ctx = this._ctx.select( - "withSecretVariable", - { name, secret }, - ) - return new Container(ctx) - } - - /** - * Establish a runtime dependency from a container to a network service. - * - * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set. - * - * The service will be reachable from the container via the provided hostname alias. - * - * The service dependency will also convey to any files or directories produced by the container. - * @param alias Hostname that will resolve to the target service (only accessible from within this container) - * @param service The target service - */ - withServiceBinding = (alias: string, service: Service): Container => { - - const ctx = this._ctx.select( - "withServiceBinding", - { alias, service }, - ) - return new Container(ctx) - } - - /** - * Return a snapshot with a symlink - * @param target Location of the file or directory to link to (e.g., "/existing/file"). - * @param linkName Location where the symbolic link will be created (e.g., "/new-file-link"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). - */ - withSymlink = (target: string, linkName: string, opts?: ContainerWithSymlinkOpts): Container => { - - const ctx = this._ctx.select( - "withSymlink", - { target, linkName, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container plus a socket forwarded to the given Unix socket path. - * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket"). - * @param source Identifier of the socket to forward. - * @param opts.owner A user:group to set for the mounted socket. - * - * The user and group can either be an ID (1000:1000) or a name (foo:bar). - * - * If the group is omitted, it defaults to the same as the user. - * @param opts.inheritOwner Set the owner to the container's current user. - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withUnixSocket = (path: string, source: Socket, opts?: ContainerWithUnixSocketOpts): Container => { - - const ctx = this._ctx.select( - "withUnixSocket", - { path, source, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container with a different command user. - * @param name The user to set (e.g., "root"). - */ - withUser = (name: string): Container => { - - const ctx = this._ctx.select( - "withUser", - { name }, - ) - return new Container(ctx) - } - - /** - * Set a new non-secret environment variable for future execs without invalidating exec cache when only its value changes. - * - * This is an expert-only escape hatch. If a volatile value affects observable exec results, stale cached results may be reused. - * @param name Name of the volatile variable (e.g., "CI_RUN_ID"). - * @param value Value of the volatile variable. - */ - withVolatileVariable = (name: string, value: string): Container => { - - const ctx = this._ctx.select( - "withVolatileVariable", - { name, value }, - ) - return new Container(ctx) - } - - /** - * Change the container's working directory. Like WORKDIR in Dockerfile. - * @param path The path to set as the working directory (e.g., "/app"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withWorkdir = (path: string, opts?: ContainerWithWorkdirOpts): Container => { - - const ctx = this._ctx.select( - "withWorkdir", - { path, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container minus the given OCI annotation. - * @param name The name of the annotation. - */ - withoutAnnotation = (name: string): Container => { - - const ctx = this._ctx.select( - "withoutAnnotation", - { name }, - ) - return new Container(ctx) - } - - /** - * Remove the container's default arguments. - */ - withoutDefaultArgs = (): Container => { - - const ctx = this._ctx.select( - "withoutDefaultArgs", - ) - return new Container(ctx) - } - - /** - * Return a new container snapshot, with a directory removed from its filesystem - * @param path Location of the directory to remove (e.g., ".github/"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withoutDirectory = (path: string, opts?: ContainerWithoutDirectoryOpts): Container => { - - const ctx = this._ctx.select( - "withoutDirectory", - { path, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container without a configured docker healtcheck command. - */ - withoutDockerHealthcheck = (): Container => { - - const ctx = this._ctx.select( - "withoutDockerHealthcheck", - ) - return new Container(ctx) - } - - /** - * Reset the container's OCI entrypoint. - * @param opts.keepDefaultArgs Don't remove the default arguments when unsetting the entrypoint. - */ - withoutEntrypoint = (opts?: ContainerWithoutEntrypointOpts): Container => { - - const ctx = this._ctx.select( - "withoutEntrypoint", - { ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container minus the given environment variable. - * @param name The name of the environment variable (e.g., "HOST"). - */ - withoutEnvVariable = (name: string): Container => { - - const ctx = this._ctx.select( - "withoutEnvVariable", - { name }, - ) - return new Container(ctx) - } - - /** - * Unexpose a previously exposed port. - * @param port Port number to unexpose - * @param opts.protocol Port protocol to unexpose - */ - withoutExposedPort = (port: number, opts?: ContainerWithoutExposedPortOpts): Container => { - const metadata = { - protocol: { is_enum: true, value_to_name: NetworkProtocolValueToName }, - } - - - const ctx = this._ctx.select( - "withoutExposedPort", - { port, ...opts, __metadata: metadata }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container with the file at the given path removed. - * @param path Location of the file to remove (e.g., "/file.txt"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). - */ - withoutFile = (path: string, opts?: ContainerWithoutFileOpts): Container => { - - const ctx = this._ctx.select( - "withoutFile", - { path, ...opts }, - ) - return new Container(ctx) - } - - /** - * Return a new container spanshot with specified files removed - * @param paths Paths of the files to remove. Example: ["foo.txt, "/root/.ssh/config" - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of paths according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). - */ - withoutFiles = (paths: string[], opts?: ContainerWithoutFilesOpts): Container => { - - const ctx = this._ctx.select( - "withoutFiles", - { paths, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container minus the given environment label. - * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created"). - */ - withoutLabel = (name: string): Container => { - - const ctx = this._ctx.select( - "withoutLabel", - { name }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container after unmounting everything at the given path. - * @param path Location of the cache directory (e.g., "/root/.npm"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withoutMount = (path: string, opts?: ContainerWithoutMountOpts): Container => { - - const ctx = this._ctx.select( - "withoutMount", - { path, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container without the registry authentication of a given address. - * @param address Registry's address to remove the authentication from. - * - * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main). - */ - withoutRegistryAuth = (address: string): Container => { - - const ctx = this._ctx.select( - "withoutRegistryAuth", - { address }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container minus the given environment variable containing the secret. - * @param name The name of the environment variable (e.g., "HOST"). - */ - withoutSecretVariable = (name: string): Container => { - - const ctx = this._ctx.select( - "withoutSecretVariable", - { name }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container with a previously added Unix socket removed. - * @param path Location of the socket to remove (e.g., "/tmp/socket"). - * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). - */ - withoutUnixSocket = (path: string, opts?: ContainerWithoutUnixSocketOpts): Container => { - - const ctx = this._ctx.select( - "withoutUnixSocket", - { path, ...opts }, - ) - return new Container(ctx) - } - - /** - * Retrieves this container with an unset command user. - * - * Should default to root. - */ - withoutUser = (): Container => { - - const ctx = this._ctx.select( - "withoutUser", - ) - return new Container(ctx) - } - - /** - * Retrieves this container minus the given volatile environment variable. - * @param name The name of the volatile environment variable (e.g., "CI_RUN_ID"). - */ - withoutVolatileVariable = (name: string): Container => { - - const ctx = this._ctx.select( - "withoutVolatileVariable", - { name }, - ) - return new Container(ctx) - } - - /** - * Unset the container's working directory. - * - * Should default to "/". - */ - withoutWorkdir = (): Container => { - - const ctx = this._ctx.select( - "withoutWorkdir", - ) - return new Container(ctx) - } - - /** - * Retrieves the working directory for all commands. - */ - workdir = async (): Promise => { - if (this._workdir) { - return this._workdir - } - - const ctx = this._ctx.select( - "workdir", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Call the provided function with current Container. - * - * This is useful for reusability and readability by not breaking the calling chain. - */ - with = (arg: (param: Container) => Container) => { - return arg(this) - } -} - -/** - * Reflective module API provided to functions at runtime. - */ -export class CurrentModule extends BaseClient { - private readonly _id?: ID = undefined - private readonly _name?: string = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _name?: string, - ) { - super(ctx) - - this._id = _id - this._name = _name - } - - /** - * A unique identifier for this CurrentModule. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Treat the currently executing module as an SDK installed in the given workspace, exposing the modules and clients it manages. - * - * Errors if the current module is not installed as an SDK in this workspace. - * @param opts.workspace The workspace to resolve SDK-role data against. Defaults to the current workspace. - */ - asSDK = (opts?: CurrentModuleAsSdkOpts): CurrentModuleAsSDK => { - - const ctx = this._ctx.select( - "asSDK", - { ...opts }, - ) - return new CurrentModuleAsSDK(ctx) - } - - /** - * The dependencies of the module. - */ - dependencies = async (): Promise => { - type dependencies = { - id: ID - } - - const ctx = this._ctx.select( - "dependencies", - ).select("id") - - const response: Awaited = await ctx.execute() - - - return response.map((r) => new Module_(ctx.copy().selectNode(r.id, "Module"))) - } - - /** - * The generated files and directories made on top of the module source's context directory. - */ - generatedContextDirectory = (): Directory => { - - const ctx = this._ctx.select( - "generatedContextDirectory", - ) - return new Directory(ctx) - } - - /** - * Return all generators defined by the module - * @param opts.include Only include generators matching the specified patterns - * @experimental - */ - generators = (opts?: CurrentModuleGeneratorsOpts): GeneratorGroup => { - - const ctx = this._ctx.select( - "generators", - { ...opts }, - ) - return new GeneratorGroup(ctx) - } - - /** - * The name of the module being executed in - */ - name = async (): Promise => { - if (this._name) { - return this._name - } - - const ctx = this._ctx.select( - "name", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The directory containing the module's source code loaded into the engine (plus any generated code that may have been created). - */ - source = (): Directory => { - - const ctx = this._ctx.select( - "source", - ) - return new Directory(ctx) - } - - /** - * Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution. - * @param path Location of the directory to access (e.g., "."). - * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). - * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). - * @param opts.gitignore Apply .gitignore filter rules inside the directory - */ - workdir = (path: string, opts?: CurrentModuleWorkdirOpts): Directory => { - - const ctx = this._ctx.select( - "workdir", - { path, ...opts }, - ) - return new Directory(ctx) - } - - /** - * Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution. - * @param path Location of the file to retrieve (e.g., "README.md"). - */ - workdirFile = (path: string): File => { - - const ctx = this._ctx.select( - "workdirFile", - { path }, - ) - return new File(ctx) - } -} - -/** - * The SDK-role data for the currently executing module, as installed in the active workspace. - */ -export class CurrentModuleAsSDK extends BaseClient { - private readonly _id?: ID = undefined - private readonly _name?: string = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _name?: string, - ) { - super(ctx) - - this._id = _id - this._name = _name - } - - /** - * A unique identifier for this CurrentModuleAsSDK. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The generated clients this SDK produces in the workspace. - */ - clients = async (): Promise => { - type clients = { - id: ID - } - - const ctx = this._ctx.select( - "clients", - ).select("id") - - const response: Awaited = await ctx.execute() - - - return response.map((r) => new CurrentModuleAsSDKClient(ctx.copy().selectNode(r.id, "CurrentModuleAsSDKClient"))) - } - - /** - * The workspace-local modules this SDK authors and manages. - */ - modules = async (): Promise => { - type modules = { - id: ID - } - - const ctx = this._ctx.select( - "modules", - ).select("id") - - const response: Awaited = await ctx.execute() - - - return response.map((r) => new CurrentModuleAsSDKModule(ctx.copy().selectNode(r.id, "CurrentModuleAsSDKModule"))) - } - - /** - * The user-facing name of this SDK in the workspace. - */ - name = async (): Promise => { - if (this._name) { - return this._name - } - - const ctx = this._ctx.select( - "name", - ) - - const response: Awaited = await ctx.execute() - - - return response - } -} - -/** - * A generated client the current SDK produces in the workspace. - */ -export class CurrentModuleAsSDKClient extends BaseClient { - private readonly _id?: ID = undefined - private readonly _module?: string = undefined - private readonly _path?: string = undefined - private readonly _pin?: string = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _module?: string, - _path?: string, - _pin?: string, - ) { - super(ctx) - - this._id = _id - this._module = _module - this._path = _path - this._pin = _pin - } - - /** - * A unique identifier for this CurrentModuleAsSDKClient. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The module the client is bound to (workspace-relative path or canonical ref). - */ - module_ = async (): Promise => { - if (this._module) { - return this._module - } - - const ctx = this._ctx.select( - "module", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The resolved module source this client is bound to, including its dependency closure and pinned version. - */ - moduleSource = (): ModuleSource => { - - const ctx = this._ctx.select( - "moduleSource", - ) - return new ModuleSource(ctx) - } - - /** - * Workspace-root-relative path of the generated client. - */ - path = async (): Promise => { - if (this._path) { - return this._path - } - - const ctx = this._ctx.select( - "path", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The pinned version of the bound module, if any. - */ - pin = async (): Promise => { - if (this._pin) { - return this._pin - } - - const ctx = this._ctx.select( - "pin", - ) - - const response: Awaited = await ctx.execute() - - - return response - } -} - -/** - * A workspace-local module managed by the current SDK. - */ -export class CurrentModuleAsSDKModule extends BaseClient { - private readonly _id?: ID = undefined - private readonly _path?: string = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _path?: string, - ) { - super(ctx) - - this._id = _id - this._path = _path - } - - /** - * A unique identifier for this CurrentModuleAsSDKModule. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Workspace-root-relative path to the managed module. - */ - path = async (): Promise => { - if (this._path) { - return this._path - } - - const ctx = this._ctx.select( - "path", - ) - - const response: Awaited = await ctx.execute() - - - return response - } -} - - -export class DiffStat extends BaseClient { - private readonly _id?: ID = undefined - private readonly _addedLines?: number = undefined - private readonly _kind?: DiffStatKind = undefined - private readonly _oldPath?: string = undefined - private readonly _path?: string = undefined - private readonly _removedLines?: number = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _addedLines?: number, - _kind?: DiffStatKind, - _oldPath?: string, - _path?: string, - _removedLines?: number, - ) { - super(ctx) - - this._id = _id - this._addedLines = _addedLines - this._kind = _kind - this._oldPath = _oldPath - this._path = _path - this._removedLines = _removedLines - } - - /** - * A unique identifier for this DiffStat. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Number of added lines for this path. - */ - addedLines = async (): Promise => { - if (this._addedLines) { - return this._addedLines - } - - const ctx = this._ctx.select( - "addedLines", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Type of change. - */ - kind = async (): Promise => { - if (this._kind) { - return this._kind - } - - const ctx = this._ctx.select( - "kind", - ) - - const response: Awaited = await ctx.execute() - - return DiffStatKindNameToValue(response) - } - - /** - * Previous path of the file, set only for renames. - */ - oldPath = async (): Promise => { - if (this._oldPath) { - return this._oldPath - } - - const ctx = this._ctx.select( - "oldPath", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Path of the changed file or directory. - */ - path = async (): Promise => { - if (this._path) { - return this._path - } - - const ctx = this._ctx.select( - "path", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Number of removed lines for this path. - */ - removedLines = async (): Promise => { - if (this._removedLines) { - return this._removedLines - } - - const ctx = this._ctx.select( - "removedLines", - ) - - const response: Awaited = await ctx.execute() - - - return response - } -} - - - -/** - * A directory. - */ -export class Directory extends BaseClient { - private readonly _id?: ID = undefined - private readonly _digest?: string = undefined - private readonly _exists?: boolean = undefined - private readonly _export?: string = undefined - private readonly _findUp?: string = undefined - private readonly _name?: string = undefined - private readonly _sync?: ID = undefined - - /** - * Constructor is used for internal usage only, do not create object from it. - */ - constructor( - ctx?: Context, - _id?: ID, - _digest?: string, - _exists?: boolean, - _export?: string, - _findUp?: string, - _name?: string, - _sync?: ID, - ) { - super(ctx) - - this._id = _id - this._digest = _digest - this._exists = _exists - this._export = _export - this._findUp = _findUp - this._name = _name - this._sync = _sync - } - - /** - * A unique identifier for this Directory. - */ - id = async (): Promise => { - if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Converts this directory to a local git repository - */ - asGit = (): GitRepository => { - - const ctx = this._ctx.select( - "asGit", - ) - return new GitRepository(ctx) - } - - /** - * Load the directory as a Dagger module source - * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file. - * - * If not set, the module source code is loaded from the root of the directory. - */ - asModule = (opts?: DirectoryAsModuleOpts): Module_ => { - - const ctx = this._ctx.select( - "asModule", - { ...opts }, - ) - return new Module_(ctx) - } - - /** - * Load the directory as a Dagger module source - * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file. - * - * If not set, the module source code is loaded from the root of the directory. - */ - asModuleSource = (opts?: DirectoryAsModuleSourceOpts): ModuleSource => { - - const ctx = this._ctx.select( - "asModuleSource", - { ...opts }, - ) - return new ModuleSource(ctx) - } - - /** - * Creates a synthetic workspace from this directory. - * @param opts.cwd Current working directory inside the workspace root. Defaults to the workspace root. - */ - asWorkspace = (opts?: DirectoryAsWorkspaceOpts): Workspace => { - - const ctx = this._ctx.select( - "asWorkspace", - { ...opts }, - ) - return new Workspace(ctx) - } - - /** - * Return the difference between this directory and another directory, typically an older snapshot. - * - * The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories. - * @param from The base directory snapshot to compare against - */ - changes = (from: Directory): Changeset => { - - const ctx = this._ctx.select( - "changes", - { from }, - ) - return new Changeset(ctx) - } - - /** - * Change the owner of the directory contents recursively. - * @param path Path of the directory to change ownership of (e.g., "/"). - * @param owner A user:group to set for the mounted directory and its contents. - * - * The user and group can either be an ID (1000:1000) or a name (foo:bar). - * - * If the group is omitted, it defaults to the same as the user. - */ - chown = (path: string, owner: string): Directory => { - - const ctx = this._ctx.select( - "chown", - { path, owner }, - ) - return new Directory(ctx) - } - - /** - * Return the difference between this directory and an another directory. The difference is encoded as a directory. - * @param other The directory to compare against - */ - diff = (other: Directory): Directory => { - - const ctx = this._ctx.select( - "diff", - { other }, - ) - return new Directory(ctx) - } - - /** - * Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine. - */ - digest = async (): Promise => { - if (this._digest) { - return this._digest - } - - const ctx = this._ctx.select( - "digest", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Retrieves a directory at the given path. - * @param path Location of the directory to retrieve. Example: "/src" - */ - directory = (path: string): Directory => { - - const ctx = this._ctx.select( - "directory", - { path }, - ) - return new Directory(ctx) - } - - /** - * Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features. - * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile"). - * @param opts.platform The platform to build. - * @param opts.buildArgs Build arguments to use in the build. - * @param opts.target Target build stage to build. - * @param opts.secrets Secrets to pass to the build. - * - * They will be mounted at /run/secrets/[secret-name]. - * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements. - * - * This should only be used if the user requires that their exec processes be the pid 1 process in the container. Otherwise it may result in unexpected behavior. - * @param opts.ssh A socket to use for SSH authentication during the build - * - * (e.g., for Dockerfile RUN --mount=type=ssh instructions). - * - * Typically obtained via host.unixSocket() pointing to the SSH_AUTH_SOCK. - */ - dockerBuild = (opts?: DirectoryDockerBuildOpts): Container => { - - const ctx = this._ctx.select( - "dockerBuild", - { ...opts }, - ) - return new Container(ctx) - } - - /** - * Returns a list of files and directories at the given path. - * @param opts.path Location of the directory to look at (e.g., "/src"). - */ - entries = async ( - opts?: DirectoryEntriesOpts): Promise => { - const ctx = this._ctx.select( - "entries", - { ...opts}, - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * check if a file or directory exists - * @param path Path to check (e.g., "/file.txt"). - * @param opts.expectedType If specified, also validate the type of file (e.g. "REGULAR_TYPE", "DIRECTORY_TYPE", or "SYMLINK_TYPE"). - * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. - */ - exists = async (path: string, - opts?: DirectoryExistsOpts): Promise => { - if (this._exists) { - return this._exists - } - - const metadata = { - expectedType: { is_enum: true, value_to_name: ExistsTypeValueToName }, - } - - const ctx = this._ctx.select( - "exists", - { path, ...opts, __metadata: metadata}, - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Writes the contents of the directory to a path on the host. - * @param path Location of the copied directory (e.g., "logs/"). - * @param opts.wipe If true, then the host directory will be wiped clean before exporting so that it exactly matches the directory being exported; this means it will delete any files on the host that aren't in the exported dir. If false (the default), the contents of the directory will be merged with any existing contents of the host directory, leaving any existing files on the host that aren't in the exported directory alone. - */ - export = async (path: string, - opts?: DirectoryExportOpts): Promise => { - if (this._export) { - return this._export - } - - const ctx = this._ctx.select( - "export", - { path, ...opts}, - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Retrieve a file at the given path. - * @param path Location of the file to retrieve (e.g., "README.md"). - */ - file = (path: string): File => { - - const ctx = this._ctx.select( - "file", - { path }, - ) - return new File(ctx) - } - - /** - * Return a snapshot with some paths included or excluded - * @param opts.exclude If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"] - * @param opts.include If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]). - * @param opts.gitignore If set, apply .gitignore rules when filtering the directory. - */ - filter = (opts?: DirectoryFilterOpts): Directory => { - - const ctx = this._ctx.select( - "filter", - { ...opts }, - ) - return new Directory(ctx) - } - - /** - * Search up the directory tree for a file or directory, and return its path. If no match, return null - * @param name The name of the file or directory to search for - * @param start The path to start the search from - */ - findUp = async (name: string, start: string): Promise => { - if (this._findUp) { - return this._findUp - } - - const ctx = this._ctx.select( - "findUp", - { name, start}, - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * Returns a list of files and directories that matche the given pattern. - * @param pattern Pattern to match (e.g., "*.md"). - */ - glob = async (pattern: string): Promise => { - const ctx = this._ctx.select( - "glob", - { pattern}, - ) - - const response: Awaited = await ctx.execute() - - - return response + { directory }, + ) + return new Container(ctx) } /** - * Returns the name of the directory. + * Set a new environment variable, using a secret value + * @param name Name of the secret variable (e.g., "API_SECRET"). + * @param secret Identifier of the secret value. */ - name = async (): Promise => { - if (this._name) { - return this._name - } + withSecretVariable = (name: string, secret: Secret): Container => { const ctx = this._ctx.select( - "name", + "withSecretVariable", + { name, secret }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * Searches for content matching the given regular expression or literal string. + * Establish a runtime dependency from a container to a network service. * - * Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. - * @param opts.paths Directory or file paths to search - * @param opts.globs Glob patterns to match (e.g., "*.md") - * @param opts.pattern The text to match. - * @param opts.literal Interpret the pattern as a literal string instead of a regular expression. - * @param opts.multiline Enable searching across multiple lines. - * @param opts.dotall Allow the . pattern to match newlines in multiline mode. - * @param opts.insensitive Enable case-insensitive matching. - * @param opts.skipIgnored Honor .gitignore, .ignore, and .rgignore files. - * @param opts.skipHidden Skip hidden files (files starting with .). - * @param opts.filesOnly Only return matching files, not lines and content - * @param opts.limit Limit the number of results to return + * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set. + * + * The service will be reachable from the container via the provided hostname alias. + * + * The service dependency will also convey to any files or directories produced by the container. + * @param alias Hostname that will resolve to the target service (only accessible from within this container) + * @param service The target service */ - search = async ( - opts?: DirectorySearchOpts): Promise => { - type search = { - id: ID - } + withServiceBinding = (alias: string, service: Service): Container => { const ctx = this._ctx.select( - "search", - { ...opts}, - ).select("id") - - const response: Awaited = await ctx.execute() - - - return response.map((r) => new SearchResult(ctx.copy().selectNode(r.id, "SearchResult"))) + "withServiceBinding", + { alias, service }, + ) + return new Container(ctx) } /** - * Return file status - * @param path Path to stat (e.g., "/file.txt"). - * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. + * Return a snapshot with a symlink + * @param target Location of the file or directory to link to (e.g., "/existing/file"). + * @param linkName Location where the symbolic link will be created (e.g., "/new-file-link"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). */ - stat = (path: string, opts?: DirectoryStatOpts): Stat => { + withSymlink = (target: string, linkName: string, opts?: ContainerWithSymlinkOpts): Container => { const ctx = this._ctx.select( - "stat", - { path, ...opts }, + "withSymlink", + { target, linkName, ...opts }, ) - return new Stat(ctx) + return new Container(ctx) } /** - * Force evaluation in the engine. + * Retrieves this container plus a socket forwarded to the given Unix socket path. + * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket"). + * @param source Identifier of the socket to forward. + * @param opts.owner A user:group to set for the mounted socket. + * + * The user and group can either be an ID (1000:1000) or a name (foo:bar). + * + * If the group is omitted, it defaults to the same as the user. + * @param opts.inheritOwner Set the owner to the container's current user. + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - sync = async (): Promise => { + withUnixSocket = (path: string, source: Socket, opts?: ContainerWithUnixSocketOpts): Container => { + const ctx = this._ctx.select( - "sync", + "withUnixSocket", + { path, source, ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return new Directory(ctx.copy().selectNode(response, "Directory")) + return new Container(ctx) } /** - * Opens an interactive terminal in new container with this directory mounted inside. - * @param opts.container If set, override the default container used for the terminal. - * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead. - * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. - * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. + * Retrieves this container with a different command user. + * @param name The user to set (e.g., "root"). */ - terminal = (opts?: DirectoryTerminalOpts): Directory => { + withUser = (name: string): Container => { const ctx = this._ctx.select( - "terminal", - { ...opts }, + "withUser", + { name }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a directory with changes from another directory applied to it. - * @param changes Changes to apply to the directory + * Set a new non-secret environment variable for future execs without invalidating exec cache when only its value changes. + * + * This is an expert-only escape hatch. If a volatile value affects observable exec results, stale cached results may be reused. + * @param name Name of the volatile variable (e.g., "CI_RUN_ID"). + * @param value Value of the volatile variable. */ - withChanges = (changes: Changeset): Directory => { + withVolatileVariable = (name: string, value: string): Container => { const ctx = this._ctx.select( - "withChanges", - { changes }, + "withVolatileVariable", + { name, value }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with a directory added - * @param path Location of the written directory (e.g., "/src/"). - * @param source Identifier of the directory to copy. - * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). - * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). - * @param opts.gitignore Apply .gitignore filter rules inside the directory - * @param opts.owner A user:group to set for the copied directory and its contents. - * - * The user and group can either be an ID (1000:1000) or a name (foo:bar). - * - * If the group is omitted, it defaults to the same as the user. - * @param opts.permissions Permission given to the copied directory and contents (e.g., 0755). + * Change the container's working directory. Like WORKDIR in Dockerfile. + * @param path The path to set as the working directory (e.g., "/app"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - withDirectory = (path: string, source: Directory, opts?: DirectoryWithDirectoryOpts): Directory => { + withWorkdir = (path: string, opts?: ContainerWithWorkdirOpts): Container => { const ctx = this._ctx.select( - "withDirectory", - { path, source, ...opts }, + "withWorkdir", + { path, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Raise an error. - * @param err Message of the error to raise. If empty, the error will be ignored. + * Retrieves this container minus the given OCI annotation. + * @param name The name of the annotation. */ - withError = (err: string): Directory => { + withoutAnnotation = (name: string): Container => { const ctx = this._ctx.select( - "withError", - { err }, + "withoutAnnotation", + { name }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory plus the contents of the given file copied to the given path. - * @param path Location of the copied file (e.g., "/file.txt"). - * @param source Identifier of the file to copy. - * @param opts.permissions Permission given to the copied file (e.g., 0600). - * @param opts.owner A user:group to set for the copied directory and its contents. - * - * The user and group can either be an ID (1000:1000) or a name (foo:bar). - * - * If the group is omitted, it defaults to the same as the user. + * Remove the container's default arguments. */ - withFile = (path: string, source: File, opts?: DirectoryWithFileOpts): Directory => { + withoutDefaultArgs = (): Container => { const ctx = this._ctx.select( - "withFile", - { path, source, ...opts }, + "withoutDefaultArgs", ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory plus the contents of the given files copied to the given path. - * @param path Location where copied files should be placed (e.g., "/src"). - * @param sources Identifiers of the files to copy. - * @param opts.permissions Permission given to the copied files (e.g., 0600). + * Return a new container snapshot, with a directory removed from its filesystem + * @param path Location of the directory to remove (e.g., ".github/"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - withFiles = (path: string, sources: File[], opts?: DirectoryWithFilesOpts): Directory => { + withoutDirectory = (path: string, opts?: ContainerWithoutDirectoryOpts): Container => { const ctx = this._ctx.select( - "withFiles", - { path, sources, ...opts }, + "withoutDirectory", + { path, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory plus a new directory created at the given path. - * @param path Location of the directory created (e.g., "/logs"). - * @param opts.permissions Permission granted to the created directory (e.g., 0777). + * Retrieves this container without a configured docker healtcheck command. */ - withNewDirectory = (path: string, opts?: DirectoryWithNewDirectoryOpts): Directory => { + withoutDockerHealthcheck = (): Container => { const ctx = this._ctx.select( - "withNewDirectory", - { path, ...opts }, + "withoutDockerHealthcheck", ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with a new file added - * @param path Path of the new file. Example: "foo/bar.txt" - * @param contents Contents of the new file. Example: "Hello world!" - * @param opts.permissions Permissions of the new file. Example: 0600 + * Reset the container's OCI entrypoint. + * @param opts.keepDefaultArgs Don't remove the default arguments when unsetting the entrypoint. */ - withNewFile = (path: string, contents: string, opts?: DirectoryWithNewFileOpts): Directory => { + withoutEntrypoint = (opts?: ContainerWithoutEntrypointOpts): Container => { const ctx = this._ctx.select( - "withNewFile", - { path, contents, ...opts }, + "withoutEntrypoint", + { ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory with the given Git-compatible patch applied. - * @param patch Patch to apply (e.g., "diff --git a/file.txt b/file.txt\nindex 1234567..abcdef8 100644\n--- a/file.txt\n+++ b/file.txt\n@@ -1,1 +1,1 @@\n-Hello\n+World\n"). - * @experimental + * Retrieves this container minus the given environment variable. + * @param name The name of the environment variable (e.g., "HOST"). */ - withPatch = (patch: string): Directory => { + withoutEnvVariable = (name: string): Container => { const ctx = this._ctx.select( - "withPatch", - { patch }, + "withoutEnvVariable", + { name }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory with the given Git-compatible patch file applied. - * @param patch File containing the patch to apply - * @experimental + * Unexpose a previously exposed port. + * @param port Port number to unexpose + * @param opts.protocol Port protocol to unexpose */ - withPatchFile = (patch: File): Directory => { + withoutExposedPort = (port: number, opts?: ContainerWithoutExposedPortOpts): Container => { + const metadata = { + protocol: { is_enum: true, value_to_name: NetworkProtocolValueToName }, + } + const ctx = this._ctx.select( - "withPatchFile", - { patch }, + "withoutExposedPort", + { port, ...opts, __metadata: metadata }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with a symlink - * @param target Location of the file or directory to link to (e.g., "/existing/file"). - * @param linkName Location where the symbolic link will be created (e.g., "/new-file-link"). + * Retrieves this container with the file at the given path removed. + * @param path Location of the file to remove (e.g., "/file.txt"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). */ - withSymlink = (target: string, linkName: string): Directory => { + withoutFile = (path: string, opts?: ContainerWithoutFileOpts): Container => { - const ctx = this._ctx.select( - "withSymlink", - { target, linkName }, + const ctx = this._ctx.select( + "withoutFile", + { path, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Retrieves this directory with all file/dir timestamps set to the given time. - * @param timestamp Timestamp to set dir/files in. - * - * Formatted in seconds following Unix epoch (e.g., 1672531199). + * Return a new container spanshot with specified files removed + * @param paths Paths of the files to remove. Example: ["foo.txt, "/root/.ssh/config" + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of paths according to the current environment variables defined in the container (e.g. "/$VAR/foo.txt"). */ - withTimestamps = (timestamp: number): Directory => { + withoutFiles = (paths: string[], opts?: ContainerWithoutFilesOpts): Container => { const ctx = this._ctx.select( - "withTimestamps", - { timestamp }, + "withoutFiles", + { paths, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with a subdirectory removed - * @param path Path of the subdirectory to remove. Example: ".github/workflows" + * Retrieves this container minus the given environment label. + * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created"). */ - withoutDirectory = (path: string): Directory => { + withoutLabel = (name: string): Container => { const ctx = this._ctx.select( - "withoutDirectory", - { path }, + "withoutLabel", + { name }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with a file removed - * @param path Path of the file to remove (e.g., "/file.txt"). + * Retrieves this container after unmounting everything at the given path. + * @param path Location of the cache directory (e.g., "/root/.npm"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - withoutFile = (path: string): Directory => { + withoutMount = (path: string, opts?: ContainerWithoutMountOpts): Container => { const ctx = this._ctx.select( - "withoutFile", - { path }, + "withoutMount", + { path, ...opts }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Return a snapshot with files removed - * @param paths Paths of the files to remove (e.g., ["/file.txt"]). + * Retrieves this container without the registry authentication of a given address. + * @param address Registry's address to remove the authentication from. + * + * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main). */ - withoutFiles = (paths: string[]): Directory => { + withoutRegistryAuth = (address: string): Container => { const ctx = this._ctx.select( - "withoutFiles", - { paths }, + "withoutRegistryAuth", + { address }, ) - return new Directory(ctx) + return new Container(ctx) } /** - * Call the provided function with current Directory. - * - * This is useful for reusability and readability by not breaking the calling chain. + * Retrieves this container minus the given environment variable containing the secret. + * @param name The name of the environment variable (e.g., "HOST"). */ - with = (arg: (param: Directory) => Directory) => { - return arg(this) - } -} + withoutSecretVariable = (name: string): Container => { -/** - * The Dagger engine configuration and state - */ -export class Engine extends BaseClient { - private readonly _id?: ID = undefined - private readonly _name?: string = undefined + const ctx = this._ctx.select( + "withoutSecretVariable", + { name }, + ) + return new Container(ctx) + } /** - * Constructor is used for internal usage only, do not create object from it. + * Retrieves this container with a previously added Unix socket removed. + * @param path Location of the socket to remove (e.g., "/tmp/socket"). + * @param opts.expand Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo"). */ - constructor( - ctx?: Context, - _id?: ID, - _name?: string, - ) { - super(ctx) + withoutUnixSocket = (path: string, opts?: ContainerWithoutUnixSocketOpts): Container => { - this._id = _id - this._name = _name - } + const ctx = this._ctx.select( + "withoutUnixSocket", + { path, ...opts }, + ) + return new Container(ctx) + } /** - * A unique identifier for this Engine. + * Retrieves this container with an unset command user. + * + * Should default to root. */ - id = async (): Promise => { - if (this._id) { - return this._id - } + withoutUser = (): Container => { const ctx = this._ctx.select( - "id", + "withoutUser", ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * The list of connected client IDs + * Retrieves this container minus the given volatile environment variable. + * @param name The name of the volatile environment variable (e.g., "CI_RUN_ID"). */ - clients = async (): Promise => { + withoutVolatileVariable = (name: string): Container => { + const ctx = this._ctx.select( - "clients", + "withoutVolatileVariable", + { name }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Container(ctx) } /** - * The local engine cache state tracked by dagql + * Unset the container's working directory. + * + * Should default to "/". */ - localCache = (): EngineCache => { + withoutWorkdir = (): Container => { const ctx = this._ctx.select( - "localCache", + "withoutWorkdir", ) - return new EngineCache(ctx) + return new Container(ctx) } /** - * The name of the engine instance. + * Retrieves the working directory for all commands. */ - name = async (): Promise => { - if (this._name) { - return this._name + workdir = async (): Promise => { + if (this._workdir) { + return this._workdir } const ctx = this._ctx.select( - "name", + "workdir", ) const response: Awaited = await ctx.execute() @@ -7631,18 +6034,23 @@ export class Engine extends BaseClient { return response } + + /** + * Call the provided function with current Container. + * + * This is useful for reusability and readability by not breaking the calling chain. + */ + with = (arg: (param: Container) => Container) => { + return arg(this) + } } /** - * A cache storage for the Dagger engine + * Reflective module API provided to functions at runtime. */ -export class EngineCache extends BaseClient { +export class CurrentModule extends BaseClient { private readonly _id?: ID = undefined - private readonly _maxUsedSpace?: number = undefined - private readonly _minFreeSpace?: number = undefined - private readonly _prune?: Void = undefined - private readonly _reservedSpace?: number = undefined - private readonly _targetSpace?: number = undefined + private readonly _name?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -7650,24 +6058,16 @@ export class EngineCache extends BaseClient { constructor( ctx?: Context, _id?: ID, - _maxUsedSpace?: number, - _minFreeSpace?: number, - _prune?: Void, - _reservedSpace?: number, - _targetSpace?: number, + _name?: string, ) { super(ctx) this._id = _id - this._maxUsedSpace = _maxUsedSpace - this._minFreeSpace = _minFreeSpace - this._prune = _prune - this._reservedSpace = _reservedSpace - this._targetSpace = _targetSpace + this._name = _name } /** - * A unique identifier for this EngineCache. + * A unique identifier for this CurrentModule. */ id = async (): Promise => { if (this._id) { @@ -7685,126 +6085,128 @@ export class EngineCache extends BaseClient { } /** - * The current set of entries in the cache + * Treat the currently executing module as an SDK installed in the given workspace, exposing the modules and clients it manages. + * + * Errors if the current module is not installed as an SDK in this workspace. + * @param workspace The workspace to resolve SDK-role data against. */ - entrySet = (opts?: EngineCacheEntrySetOpts): EngineCacheEntrySet => { + asSDK = (workspace: Workspace): CurrentModuleAsSDK => { const ctx = this._ctx.select( - "entrySet", - { ...opts }, + "asSDK", + { workspace }, ) - return new EngineCacheEntrySet(ctx) + return new CurrentModuleAsSDK(ctx) } /** - * The maximum bytes to keep in the cache without pruning. + * The dependencies of the module. */ - maxUsedSpace = async (): Promise => { - if (this._maxUsedSpace) { - return this._maxUsedSpace + dependencies = async (): Promise => { + type dependencies = { + id: ID } const ctx = this._ctx.select( - "maxUsedSpace", - ) + "dependencies", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new Module_(ctx.copy().selectNode(r.id, "Module"))) } /** - * The target amount of free disk space the garbage collector will attempt to leave. + * The generated files and directories made on top of the module source's context directory. */ - minFreeSpace = async (): Promise => { - if (this._minFreeSpace) { - return this._minFreeSpace - } + generatedContextDirectory = (): Directory => { const ctx = this._ctx.select( - "minFreeSpace", + "generatedContextDirectory", ) + return new Directory(ctx) + } - const response: Awaited = await ctx.execute() + /** + * Return all generators defined by the module + * @param opts.include Only include generators matching the specified patterns + * @experimental + */ + generators = (opts?: CurrentModuleGeneratorsOpts): GeneratorGroup => { - - return response + const ctx = this._ctx.select( + "generators", + { ...opts }, + ) + return new GeneratorGroup(ctx) } /** - * Prune the cache of releaseable entries - * @param opts.useDefaultPolicy Use the engine-wide default pruning policy if true, otherwise prune the whole cache of any releasable entries. - * @param opts.maxUsedSpace Override the maximum disk space to keep before pruning (e.g. "200GB" or "80%"). - * @param opts.reservedSpace Override the minimum disk space to retain during pruning (e.g. "500GB" or "10%"). - * @param opts.minFreeSpace Override the minimum free disk space target during pruning (e.g. "20GB" or "20%"). - * @param opts.targetSpace Override the target disk space to keep after pruning (e.g. "200GB" or "50%"). + * The name of the module being executed in */ - prune = async ( - opts?: EngineCachePruneOpts): Promise => { - if (this._prune) { - return + name = async (): Promise => { + if (this._name) { + return this._name } const ctx = this._ctx.select( - "prune", - { ...opts}, + "name", ) - await ctx.execute() + const response: Awaited = await ctx.execute() + return response } /** - * The minimum amount of disk space this policy is guaranteed to retain. + * The directory containing the module's source code loaded into the engine (plus any generated code that may have been created). */ - reservedSpace = async (): Promise => { - if (this._reservedSpace) { - return this._reservedSpace - } + source = (): Directory => { const ctx = this._ctx.select( - "reservedSpace", + "source", ) - - const response: Awaited = await ctx.execute() - - - return response + return new Directory(ctx) } /** - * The target number of bytes to keep when pruning. + * Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution. + * @param path Location of the directory to access (e.g., "."). + * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). + * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). + * @param opts.gitignore Apply .gitignore filter rules inside the directory */ - targetSpace = async (): Promise => { - if (this._targetSpace) { - return this._targetSpace - } + workdir = (path: string, opts?: CurrentModuleWorkdirOpts): Directory => { const ctx = this._ctx.select( - "targetSpace", + "workdir", + { path, ...opts }, ) + return new Directory(ctx) + } - const response: Awaited = await ctx.execute() + /** + * Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution. + * @param path Location of the file to retrieve (e.g., "README.md"). + */ + workdirFile = (path: string): File => { - - return response + const ctx = this._ctx.select( + "workdirFile", + { path }, + ) + return new File(ctx) } } /** - * An individual cache entry in a cache entry set + * The SDK-role data for the currently executing module, as installed in the supplied workspace. */ -export class EngineCacheEntry extends BaseClient { +export class CurrentModuleAsSDK extends BaseClient { private readonly _id?: ID = undefined - private readonly _activelyUsed?: boolean = undefined - private readonly _createdTimeUnixNano?: number = undefined - private readonly _dagqlCall?: string = undefined - private readonly _description?: string = undefined - private readonly _diskSpaceBytes?: number = undefined - private readonly _mostRecentUseTimeUnixNano?: number = undefined - private readonly _recordType?: string = undefined + private readonly _name?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -7812,28 +6214,16 @@ export class EngineCacheEntry extends BaseClient { constructor( ctx?: Context, _id?: ID, - _activelyUsed?: boolean, - _createdTimeUnixNano?: number, - _dagqlCall?: string, - _description?: string, - _diskSpaceBytes?: number, - _mostRecentUseTimeUnixNano?: number, - _recordType?: string, + _name?: string, ) { super(ctx) this._id = _id - this._activelyUsed = _activelyUsed - this._createdTimeUnixNano = _createdTimeUnixNano - this._dagqlCall = _dagqlCall - this._description = _description - this._diskSpaceBytes = _diskSpaceBytes - this._mostRecentUseTimeUnixNano = _mostRecentUseTimeUnixNano - this._recordType = _recordType + this._name = _name } /** - * A unique identifier for this EngineCacheEntry. + * A unique identifier for this CurrentModuleAsSDK. */ id = async (): Promise => { if (this._id) { @@ -7851,51 +6241,51 @@ export class EngineCacheEntry extends BaseClient { } /** - * Whether the cache entry is actively being used. + * The generated clients this SDK produces in the workspace. */ - activelyUsed = async (): Promise => { - if (this._activelyUsed) { - return this._activelyUsed + clients = async (): Promise => { + type clients = { + id: ID } const ctx = this._ctx.select( - "activelyUsed", - ) + "clients", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new CurrentModuleAsSDKClient(ctx.copy().selectNode(r.id, "CurrentModuleAsSDKClient"))) } /** - * The time the cache entry was created, in Unix nanoseconds. + * The managed modules relevant to the bound workspace cwd: every module at or below it, plus the nearest enclosing module when the cwd itself is not managed. */ - createdTimeUnixNano = async (): Promise => { - if (this._createdTimeUnixNano) { - return this._createdTimeUnixNano + modules = async (): Promise => { + type modules = { + id: ID } const ctx = this._ctx.select( - "createdTimeUnixNano", - ) + "modules", + ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response + return response.map((r) => new CurrentModuleAsSDKModule(ctx.copy().selectNode(r.id, "CurrentModuleAsSDKModule"))) } /** - * The DagQL call that produced this cache entry. + * The user-facing name of this SDK in the workspace. */ - dagqlCall = async (): Promise => { - if (this._dagqlCall) { - return this._dagqlCall + name = async (): Promise => { + if (this._name) { + return this._name } const ctx = this._ctx.select( - "dagqlCall", + "name", ) const response: Awaited = await ctx.execute() @@ -7903,71 +6293,92 @@ export class EngineCacheEntry extends BaseClient { return response } +} + +/** + * A generated client the current SDK produces in the workspace. + */ +export class CurrentModuleAsSDKClient extends BaseClient { + private readonly _id?: ID = undefined + private readonly _module?: string = undefined + private readonly _path?: string = undefined + private readonly _pin?: string = undefined /** - * The description of the cache entry. + * Constructor is used for internal usage only, do not create object from it. */ - description = async (): Promise => { - if (this._description) { - return this._description + constructor( + ctx?: Context, + _id?: ID, + _module?: string, + _path?: string, + _pin?: string, + ) { + super(ctx) + + this._id = _id + this._module = _module + this._path = _path + this._pin = _pin + } + + /** + * A unique identifier for this CurrentModuleAsSDKClient. + */ + id = async (): Promise => { + if (this._id) { + return this._id } const ctx = this._ctx.select( - "description", + "id", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The disk space used by the cache entry. + * The module the client is bound to (workspace-relative path or canonical ref). */ - diskSpaceBytes = async (): Promise => { - if (this._diskSpaceBytes) { - return this._diskSpaceBytes + module_ = async (): Promise => { + if (this._module) { + return this._module } const ctx = this._ctx.select( - "diskSpaceBytes", + "module", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The most recent time the cache entry was used, in Unix nanoseconds. + * The resolved module source this client is bound to, including its dependency closure and pinned version. */ - mostRecentUseTimeUnixNano = async (): Promise => { - if (this._mostRecentUseTimeUnixNano) { - return this._mostRecentUseTimeUnixNano - } + moduleSource = (): ModuleSource => { const ctx = this._ctx.select( - "mostRecentUseTimeUnixNano", + "moduleSource", ) - - const response: Awaited = await ctx.execute() - - - return response + return new ModuleSource(ctx) } /** - * The type of the cache record (e.g. regular, internal, frontend, source.local, source.git.checkout, exec.cachemount). + * Workspace-root-relative path of the generated client. */ - recordType = async (): Promise => { - if (this._recordType) { - return this._recordType + path = async (): Promise => { + if (this._path) { + return this._path } const ctx = this._ctx.select( - "recordType", + "path", ) const response: Awaited = await ctx.execute() @@ -7977,14 +6388,18 @@ export class EngineCacheEntry extends BaseClient { } /** - * The storage record types represented by this cache entry. + * The pinned version of the bound module, if any. */ - recordTypes = async (): Promise => { + pin = async (): Promise => { + if (this._pin) { + return this._pin + } + const ctx = this._ctx.select( - "recordTypes", + "pin", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response @@ -7992,12 +6407,11 @@ export class EngineCacheEntry extends BaseClient { } /** - * A set of cache entries returned by a query to a cache + * A workspace-local module managed by the current SDK. */ -export class EngineCacheEntrySet extends BaseClient { +export class CurrentModuleAsSDKModule extends BaseClient { private readonly _id?: ID = undefined - private readonly _diskSpaceBytes?: number = undefined - private readonly _entryCount?: number = undefined + private readonly _path?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -8005,97 +6419,59 @@ export class EngineCacheEntrySet extends BaseClient { constructor( ctx?: Context, _id?: ID, - _diskSpaceBytes?: number, - _entryCount?: number, + _path?: string, ) { super(ctx) this._id = _id - this._diskSpaceBytes = _diskSpaceBytes - this._entryCount = _entryCount + this._path = _path } /** - * A unique identifier for this EngineCacheEntrySet. + * A unique identifier for this CurrentModuleAsSDKModule. */ id = async (): Promise => { if (this._id) { - return this._id - } - - const ctx = this._ctx.select( - "id", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The total disk space used by the cache entries in this set. - */ - diskSpaceBytes = async (): Promise => { - if (this._diskSpaceBytes) { - return this._diskSpaceBytes - } - - const ctx = this._ctx.select( - "diskSpaceBytes", - ) - - const response: Awaited = await ctx.execute() - - - return response - } - - /** - * The list of individual cache entries in the set - */ - entries = async (): Promise => { - type entries = { - id: ID + return this._id } const ctx = this._ctx.select( - "entries", - ).select("id") + "id", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new EngineCacheEntry(ctx.copy().selectNode(r.id, "EngineCacheEntry"))) + return response } /** - * The number of cache entries in this set. + * Workspace-root-relative path to the managed module. */ - entryCount = async (): Promise => { - if (this._entryCount) { - return this._entryCount + path = async (): Promise => { + if (this._path) { + return this._path } const ctx = this._ctx.select( - "entryCount", + "path", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } } -/** - * A definition of a custom enum defined in a Module. - */ -export class EnumTypeDef extends BaseClient { + +export class DiffStat extends BaseClient { private readonly _id?: ID = undefined - private readonly _description?: string = undefined - private readonly _name?: string = undefined - private readonly _sourceModuleName?: string = undefined + private readonly _addedLines?: number = undefined + private readonly _kind?: DiffStatKind = undefined + private readonly _oldPath?: string = undefined + private readonly _path?: string = undefined + private readonly _removedLines?: number = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -8103,20 +6479,24 @@ export class EnumTypeDef extends BaseClient { constructor( ctx?: Context, _id?: ID, - _description?: string, - _name?: string, - _sourceModuleName?: string, + _addedLines?: number, + _kind?: DiffStatKind, + _oldPath?: string, + _path?: string, + _removedLines?: number, ) { super(ctx) this._id = _id - this._description = _description - this._name = _name - this._sourceModuleName = _sourceModuleName + this._addedLines = _addedLines + this._kind = _kind + this._oldPath = _oldPath + this._path = _path + this._removedLines = _removedLines } /** - * A unique identifier for this EnumTypeDef. + * A unique identifier for this DiffStat. */ id = async (): Promise => { if (this._id) { @@ -8134,51 +6514,50 @@ export class EnumTypeDef extends BaseClient { } /** - * A doc string for the enum, if any. + * Number of added lines for this path. */ - description = async (): Promise => { - if (this._description) { - return this._description + addedLines = async (): Promise => { + if (this._addedLines) { + return this._addedLines } const ctx = this._ctx.select( - "description", + "addedLines", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * The members of the enum. + * Type of change. */ - members = async (): Promise => { - type members = { - id: ID + kind = async (): Promise => { + if (this._kind) { + return this._kind } const ctx = this._ctx.select( - "members", - ).select("id") + "kind", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - - return response.map((r) => new EnumValueTypeDef(ctx.copy().selectNode(r.id, "EnumValueTypeDef"))) + return DiffStatKindNameToValue(response) } /** - * The name of the enum. + * Previous path of the file, set only for renames. */ - name = async (): Promise => { - if (this._name) { - return this._name + oldPath = async (): Promise => { + if (this._oldPath) { + return this._oldPath } const ctx = this._ctx.select( - "name", + "oldPath", ) const response: Awaited = await ctx.execute() @@ -8188,26 +6567,15 @@ export class EnumTypeDef extends BaseClient { } /** - * The location of this enum declaration. - */ - sourceMap = (): SourceMap => { - - const ctx = this._ctx.select( - "sourceMap", - ) - return new SourceMap(ctx) - } - - /** - * If this EnumTypeDef is associated with a Module, the name of the module. Unset otherwise. + * Path of the changed file or directory. */ - sourceModuleName = async (): Promise => { - if (this._sourceModuleName) { - return this._sourceModuleName + path = async (): Promise => { + if (this._path) { + return this._path } const ctx = this._ctx.select( - "sourceModuleName", + "path", ) const response: Awaited = await ctx.execute() @@ -8217,34 +6585,37 @@ export class EnumTypeDef extends BaseClient { } /** - * The members of the enum. - * @deprecated use members instead + * Number of removed lines for this path. */ - values = async (): Promise => { - type values = { - id: ID + removedLines = async (): Promise => { + if (this._removedLines) { + return this._removedLines } const ctx = this._ctx.select( - "values", - ).select("id") + "removedLines", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new EnumValueTypeDef(ctx.copy().selectNode(r.id, "EnumValueTypeDef"))) + return response } } + + /** - * A definition of a value in a custom enum defined in a Module. + * A directory. */ -export class EnumValueTypeDef extends BaseClient { +export class Directory extends BaseClient { private readonly _id?: ID = undefined - private readonly _deprecated?: string = undefined - private readonly _description?: string = undefined + private readonly _digest?: string = undefined + private readonly _exists?: boolean = undefined + private readonly _export?: string = undefined + private readonly _findUp?: string = undefined private readonly _name?: string = undefined - private readonly _value?: string = undefined + private readonly _sync?: ID = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -8252,22 +6623,26 @@ export class EnumValueTypeDef extends BaseClient { constructor( ctx?: Context, _id?: ID, - _deprecated?: string, - _description?: string, + _digest?: string, + _exists?: boolean, + _export?: string, + _findUp?: string, _name?: string, - _value?: string, + _sync?: ID, ) { super(ctx) this._id = _id - this._deprecated = _deprecated - this._description = _description + this._digest = _digest + this._exists = _exists + this._export = _export + this._findUp = _findUp this._name = _name - this._value = _value + this._sync = _sync } /** - * A unique identifier for this EnumValueTypeDef. + * A unique identifier for this Directory. */ id = async (): Promise => { if (this._id) { @@ -8285,1584 +6660,1451 @@ export class EnumValueTypeDef extends BaseClient { } /** - * The reason this enum member is deprecated, if any. + * Converts this directory to a local git repository */ - deprecated = async (): Promise => { - if (this._deprecated) { - return this._deprecated - } + asGit = (): GitRepository => { const ctx = this._ctx.select( - "deprecated", + "asGit", ) - - const response: Awaited = await ctx.execute() - - - return response + return new GitRepository(ctx) } /** - * A doc string for the enum member, if any. + * Load the directory as a Dagger module source + * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file. + * + * If not set, the module source code is loaded from the root of the directory. */ - description = async (): Promise => { - if (this._description) { - return this._description - } + asModule = (opts?: DirectoryAsModuleOpts): Module_ => { const ctx = this._ctx.select( - "description", + "asModule", + { ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new Module_(ctx) } /** - * The name of the enum member. + * Load the directory as a Dagger module source + * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file. + * + * If not set, the module source code is loaded from the root of the directory. */ - name = async (): Promise => { - if (this._name) { - return this._name - } + asModuleSource = (opts?: DirectoryAsModuleSourceOpts): ModuleSource => { const ctx = this._ctx.select( - "name", + "asModuleSource", + { ...opts }, ) - - const response: Awaited = await ctx.execute() - - - return response + return new ModuleSource(ctx) } /** - * The location of this enum member declaration. + * Creates a synthetic workspace from this directory. + * @param opts.cwd Current working directory inside the workspace root. Defaults to the workspace root. */ - sourceMap = (): SourceMap => { + asWorkspace = (opts?: DirectoryAsWorkspaceOpts): Workspace => { const ctx = this._ctx.select( - "sourceMap", + "asWorkspace", + { ...opts }, ) - return new SourceMap(ctx) + return new Workspace(ctx) } /** - * The value of the enum member + * Return the difference between this directory and another directory, typically an older snapshot. + * + * The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories. + * @param from The base directory snapshot to compare against */ - value = async (): Promise => { - if (this._value) { - return this._value - } + changes = (from: Directory): Changeset => { const ctx = this._ctx.select( - "value", + "changes", + { from }, ) + return new Changeset(ctx) + } - const response: Awaited = await ctx.execute() + /** + * Change the owner of the directory contents recursively. + * @param path Path of the directory to change ownership of (e.g., "/"). + * @param owner A user:group to set for the mounted directory and its contents. + * + * The user and group can either be an ID (1000:1000) or a name (foo:bar). + * + * If the group is omitted, it defaults to the same as the user. + */ + chown = (path: string, owner: string): Directory => { - - return response + const ctx = this._ctx.select( + "chown", + { path, owner }, + ) + return new Directory(ctx) } -} - - -export class Env extends BaseClient { - private readonly _id?: ID = undefined /** - * Constructor is used for internal usage only, do not create object from it. + * Return the difference between this directory and an another directory. The difference is encoded as a directory. + * @param other The directory to compare against */ - constructor( - ctx?: Context, - _id?: ID, - ) { - super(ctx) + diff = (other: Directory): Directory => { - this._id = _id - } + const ctx = this._ctx.select( + "diff", + { other }, + ) + return new Directory(ctx) + } /** - * A unique identifier for this Env. + * Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine. */ - id = async (): Promise => { - if (this._id) { - return this._id + digest = async (): Promise => { + if (this._digest) { + return this._digest } const ctx = this._ctx.select( - "id", + "digest", ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() return response } /** - * Return the check with the given name from the installed modules. Must match exactly one check. - * @param name The name of the check to retrieve - * @experimental + * Retrieves a directory at the given path. + * @param path Location of the directory to retrieve. Example: "/src" */ - check = (name: string): Check => { + directory = (path: string): Directory => { const ctx = this._ctx.select( - "check", - { name }, + "directory", + { path }, ) - return new Check(ctx) + return new Directory(ctx) } /** - * Return all checks defined by the installed modules - * @param opts.include Only include checks matching the specified patterns - * @param opts.noGenerate When true, only return annotated check functions; exclude generate-as-checks - * @experimental + * Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features. + * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile"). + * @param opts.platform The platform to build. + * @param opts.buildArgs Build arguments to use in the build. + * @param opts.target Target build stage to build. + * @param opts.secrets Secrets to pass to the build. + * + * They will be mounted at /run/secrets/[secret-name]. + * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements. + * + * This should only be used if the user requires that their exec processes be the pid 1 process in the container. Otherwise it may result in unexpected behavior. + * @param opts.ssh A socket to use for SSH authentication during the build + * + * (e.g., for Dockerfile RUN --mount=type=ssh instructions). + * + * Typically obtained via host.unixSocket() pointing to the SSH_AUTH_SOCK. */ - checks = (opts?: EnvChecksOpts): CheckGroup => { + dockerBuild = (opts?: DirectoryDockerBuildOpts): Container => { const ctx = this._ctx.select( - "checks", + "dockerBuild", { ...opts }, ) - return new CheckGroup(ctx) + return new Container(ctx) } /** - * Retrieves an input binding by name + * Returns a list of files and directories at the given path. + * @param opts.path Location of the directory to look at (e.g., "/src"). */ - input = (name: string): Binding => { - + entries = async ( + opts?: DirectoryEntriesOpts): Promise => { const ctx = this._ctx.select( - "input", - { name }, + "entries", + { ...opts}, ) - return new Binding(ctx) - } - - /** - * Returns all input bindings provided to the environment - */ - inputs = async (): Promise => { - type inputs = { - id: ID - } - - const ctx = this._ctx.select( - "inputs", - ).select("id") - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))) + return response } /** - * Retrieves an output binding by name + * check if a file or directory exists + * @param path Path to check (e.g., "/file.txt"). + * @param opts.expectedType If specified, also validate the type of file (e.g. "REGULAR_TYPE", "DIRECTORY_TYPE", or "SYMLINK_TYPE"). + * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. */ - output = (name: string): Binding => { + exists = async (path: string, + opts?: DirectoryExistsOpts): Promise => { + if (this._exists) { + return this._exists + } + + const metadata = { + expectedType: { is_enum: true, value_to_name: ExistsTypeValueToName }, + } const ctx = this._ctx.select( - "output", - { name }, + "exists", + { path, ...opts, __metadata: metadata}, ) - return new Binding(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Returns all declared output bindings for the environment + * Writes the contents of the directory to a path on the host. + * @param path Location of the copied directory (e.g., "logs/"). + * @param opts.wipe If true, then the host directory will be wiped clean before exporting so that it exactly matches the directory being exported; this means it will delete any files on the host that aren't in the exported dir. If false (the default), the contents of the directory will be merged with any existing contents of the host directory, leaving any existing files on the host that aren't in the exported directory alone. */ - outputs = async (): Promise => { - type outputs = { - id: ID + export = async (path: string, + opts?: DirectoryExportOpts): Promise => { + if (this._export) { + return this._export } const ctx = this._ctx.select( - "outputs", - ).select("id") + "export", + { path, ...opts}, + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new Binding(ctx.copy().selectNode(r.id, "Binding"))) + return response } /** - * Return all services defined by the installed modules - * @param opts.include Only include services matching the specified patterns - * @experimental + * Retrieve a file at the given path. + * @param path Location of the file to retrieve (e.g., "README.md"). */ - services = (opts?: EnvServicesOpts): UpGroup => { + file = (path: string): File => { const ctx = this._ctx.select( - "services", - { ...opts }, + "file", + { path }, ) - return new UpGroup(ctx) + return new File(ctx) } /** - * Create or update a binding of type Address in the environment - * @param name The name of the binding - * @param value The Address value to assign to the binding - * @param description The purpose of the input + * Return a snapshot with some paths included or excluded + * @param opts.exclude If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"] + * @param opts.include If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]). + * @param opts.gitignore If set, apply .gitignore rules when filtering the directory. */ - withAddressInput = (name: string, value: Address, description: string): Env => { + filter = (opts?: DirectoryFilterOpts): Directory => { const ctx = this._ctx.select( - "withAddressInput", - { name, value, description }, + "filter", + { ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired Address output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Search up the directory tree for a file or directory, and return its path. If no match, return null + * @param name The name of the file or directory to search for + * @param start The path to start the search from */ - withAddressOutput = (name: string, description: string): Env => { + findUp = async (name: string, start: string): Promise => { + if (this._findUp) { + return this._findUp + } const ctx = this._ctx.select( - "withAddressOutput", - { name, description }, + "findUp", + { name, start}, ) - return new Env(ctx) - } - /** - * Create or update a binding of type CacheVolume in the environment - * @param name The name of the binding - * @param value The CacheVolume value to assign to the binding - * @param description The purpose of the input - */ - withCacheVolumeInput = (name: string, value: CacheVolume, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withCacheVolumeInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired CacheVolume output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Returns a list of files and directories that matche the given pattern. + * @param pattern Pattern to match (e.g., "*.md"). */ - withCacheVolumeOutput = (name: string, description: string): Env => { - + glob = async (pattern: string): Promise => { const ctx = this._ctx.select( - "withCacheVolumeOutput", - { name, description }, + "glob", + { pattern}, ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Create or update a binding of type Changeset in the environment - * @param name The name of the binding - * @param value The Changeset value to assign to the binding - * @param description The purpose of the input + * Returns the name of the directory. */ - withChangesetInput = (name: string, value: Changeset, description: string): Env => { + name = async (): Promise => { + if (this._name) { + return this._name + } const ctx = this._ctx.select( - "withChangesetInput", - { name, value, description }, + "name", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Declare a desired Changeset output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Searches for content matching the given regular expression or literal string. + * + * Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes. + * @param opts.paths Directory or file paths to search + * @param opts.globs Glob patterns to match (e.g., "*.md") + * @param opts.pattern The text to match. + * @param opts.literal Interpret the pattern as a literal string instead of a regular expression. + * @param opts.multiline Enable searching across multiple lines. + * @param opts.dotall Allow the . pattern to match newlines in multiline mode. + * @param opts.insensitive Enable case-insensitive matching. + * @param opts.skipIgnored Honor .gitignore, .ignore, and .rgignore files. + * @param opts.skipHidden Skip hidden files (files starting with .). + * @param opts.filesOnly Only return matching files, not lines and content + * @param opts.limit Limit the number of results to return */ - withChangesetOutput = (name: string, description: string): Env => { + search = async ( + opts?: DirectorySearchOpts): Promise => { + type search = { + id: ID + } const ctx = this._ctx.select( - "withChangesetOutput", - { name, description }, - ) - return new Env(ctx) + "search", + { ...opts}, + ).select("id") + + const response: Awaited = await ctx.execute() + + + return response.map((r) => new SearchResult(ctx.copy().selectNode(r.id, "SearchResult"))) } /** - * Create or update a binding of type CheckGroup in the environment - * @param name The name of the binding - * @param value The CheckGroup value to assign to the binding - * @param description The purpose of the input + * Return file status + * @param path Path to stat (e.g., "/file.txt"). + * @param opts.doNotFollowSymlinks If specified, do not follow symlinks. */ - withCheckGroupInput = (name: string, value: CheckGroup, description: string): Env => { - + stat = async (path: string, + opts?: DirectoryStatOpts): Promise => { const ctx = this._ctx.select( - "withCheckGroupInput", - { name, value, description }, - ) - return new Env(ctx) + "stat", + { path, ...opts}, + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Stat(ctx.copy().selectNode(response, "Stat")) } /** - * Declare a desired CheckGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Force evaluation in the engine. */ - withCheckGroupOutput = (name: string, description: string): Env => { - + sync = async (): Promise => { const ctx = this._ctx.select( - "withCheckGroupOutput", - { name, description }, + "sync", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return new Directory(ctx.copy().selectNode(response, "Directory")) } /** - * Create or update a binding of type Check in the environment - * @param name The name of the binding - * @param value The Check value to assign to the binding - * @param description The purpose of the input + * Opens an interactive terminal in new container with this directory mounted inside. + * @param opts.container If set, override the default container used for the terminal. + * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead. + * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command. + * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands. */ - withCheckInput = (name: string, value: Check, description: string): Env => { + terminal = (opts?: DirectoryTerminalOpts): Directory => { const ctx = this._ctx.select( - "withCheckInput", - { name, value, description }, + "terminal", + { ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired Check output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Return a directory with changes from another directory applied to it. + * @param changes Changes to apply to the directory */ - withCheckOutput = (name: string, description: string): Env => { + withChanges = (changes: Changeset): Directory => { const ctx = this._ctx.select( - "withCheckOutput", - { name, description }, + "withChanges", + { changes }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type Cloud in the environment - * @param name The name of the binding - * @param value The Cloud value to assign to the binding - * @param description The purpose of the input + * Return a snapshot with a directory added + * @param path Location of the written directory (e.g., "/src/"). + * @param source Identifier of the directory to copy. + * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]). + * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]). + * @param opts.gitignore Apply .gitignore filter rules inside the directory + * @param opts.owner A user:group to set for the copied directory and its contents. + * + * The user and group can either be an ID (1000:1000) or a name (foo:bar). + * + * If the group is omitted, it defaults to the same as the user. + * @param opts.permissions Permission given to the copied directory and contents (e.g., 0755). */ - withCloudInput = (name: string, value: Cloud, description: string): Env => { + withDirectory = (path: string, source: Directory, opts?: DirectoryWithDirectoryOpts): Directory => { const ctx = this._ctx.select( - "withCloudInput", - { name, value, description }, + "withDirectory", + { path, source, ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired Cloud output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Raise an error. + * @param err Message of the error to raise. If empty, the error will be ignored. */ - withCloudOutput = (name: string, description: string): Env => { + withError = (err: string): Directory => { const ctx = this._ctx.select( - "withCloudOutput", - { name, description }, + "withError", + { err }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type Container in the environment - * @param name The name of the binding - * @param value The Container value to assign to the binding - * @param description The purpose of the input + * Retrieves this directory plus the contents of the given file copied to the given path. + * @param path Location of the copied file (e.g., "/file.txt"). + * @param source Identifier of the file to copy. + * @param opts.permissions Permission given to the copied file (e.g., 0600). + * @param opts.owner A user:group to set for the copied directory and its contents. + * + * The user and group can either be an ID (1000:1000) or a name (foo:bar). + * + * If the group is omitted, it defaults to the same as the user. */ - withContainerInput = (name: string, value: Container, description: string): Env => { + withFile = (path: string, source: File, opts?: DirectoryWithFileOpts): Directory => { const ctx = this._ctx.select( - "withContainerInput", - { name, value, description }, + "withFile", + { path, source, ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired Container output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Retrieves this directory plus the contents of the given files copied to the given path. + * @param path Location where copied files should be placed (e.g., "/src"). + * @param sources Identifiers of the files to copy. + * @param opts.permissions Permission given to the copied files (e.g., 0600). */ - withContainerOutput = (name: string, description: string): Env => { + withFiles = (path: string, sources: File[], opts?: DirectoryWithFilesOpts): Directory => { const ctx = this._ctx.select( - "withContainerOutput", - { name, description }, + "withFiles", + { path, sources, ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Installs the current module into the environment, exposing its functions to the model - * - * Contextual path arguments will be populated using the environment's workspace. + * Retrieves this directory plus a new directory created at the given path. + * @param path Location of the directory created (e.g., "/logs"). + * @param opts.permissions Permission granted to the created directory (e.g., 0777). */ - withCurrentModule = (): Env => { + withNewDirectory = (path: string, opts?: DirectoryWithNewDirectoryOpts): Directory => { const ctx = this._ctx.select( - "withCurrentModule", + "withNewDirectory", + { path, ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type CurrentModuleAsSDKClient in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDKClient value to assign to the binding - * @param description The purpose of the input + * Return a snapshot with a new file added + * @param path Path of the new file. Example: "foo/bar.txt" + * @param contents Contents of the new file. Example: "Hello world!" + * @param opts.permissions Permissions of the new file. Example: 0600 */ - withCurrentModuleAsSDKClientInput = (name: string, value: CurrentModuleAsSDKClient, description: string): Env => { + withNewFile = (path: string, contents: string, opts?: DirectoryWithNewFileOpts): Directory => { const ctx = this._ctx.select( - "withCurrentModuleAsSDKClientInput", - { name, value, description }, + "withNewFile", + { path, contents, ...opts }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired CurrentModuleAsSDKClient output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Retrieves this directory with the given Git-compatible patch applied. + * @param patch Patch to apply (e.g., "diff --git a/file.txt b/file.txt\nindex 1234567..abcdef8 100644\n--- a/file.txt\n+++ b/file.txt\n@@ -1,1 +1,1 @@\n-Hello\n+World\n"). + * @param opts.onConflict How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + * @experimental */ - withCurrentModuleAsSDKClientOutput = (name: string, description: string): Env => { + withPatch = (patch: string, opts?: DirectoryWithPatchOpts): Directory => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName }, + } + const ctx = this._ctx.select( - "withCurrentModuleAsSDKClientOutput", - { name, description }, + "withPatch", + { patch, ...opts, __metadata: metadata }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type CurrentModuleAsSDK in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDK value to assign to the binding - * @param description The purpose of the input + * Retrieves this directory with the given Git-compatible patch file applied. + * @param patch File containing the patch to apply + * @param opts.onConflict How to handle hunks that no longer apply to the target content: fail (default), or apply what fits and leave git-style conflict markers where it doesn't. + * @experimental */ - withCurrentModuleAsSDKInput = (name: string, value: CurrentModuleAsSDK, description: string): Env => { + withPatchFile = (patch: File, opts?: DirectoryWithPatchFileOpts): Directory => { + const metadata = { + onConflict: { is_enum: true, value_to_name: PatchConflictValueToName }, + } + const ctx = this._ctx.select( - "withCurrentModuleAsSDKInput", - { name, value, description }, + "withPatchFile", + { patch, ...opts, __metadata: metadata }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type CurrentModuleAsSDKModule in the environment - * @param name The name of the binding - * @param value The CurrentModuleAsSDKModule value to assign to the binding - * @param description The purpose of the input + * Return a snapshot with a symlink + * @param target Location of the file or directory to link to (e.g., "/existing/file"). + * @param linkName Location where the symbolic link will be created (e.g., "/new-file-link"). */ - withCurrentModuleAsSDKModuleInput = (name: string, value: CurrentModuleAsSDKModule, description: string): Env => { + withSymlink = (target: string, linkName: string): Directory => { const ctx = this._ctx.select( - "withCurrentModuleAsSDKModuleInput", - { name, value, description }, + "withSymlink", + { target, linkName }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired CurrentModuleAsSDKModule output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Retrieves this directory with all file/dir timestamps set to the given time. + * @param timestamp Timestamp to set dir/files in. + * + * Formatted in seconds following Unix epoch (e.g., 1672531199). */ - withCurrentModuleAsSDKModuleOutput = (name: string, description: string): Env => { + withTimestamps = (timestamp: number): Directory => { const ctx = this._ctx.select( - "withCurrentModuleAsSDKModuleOutput", - { name, description }, + "withTimestamps", + { timestamp }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired CurrentModuleAsSDK output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Return a snapshot with a subdirectory removed + * @param path Path of the subdirectory to remove. Example: ".github/workflows" */ - withCurrentModuleAsSDKOutput = (name: string, description: string): Env => { + withoutDirectory = (path: string): Directory => { const ctx = this._ctx.select( - "withCurrentModuleAsSDKOutput", - { name, description }, + "withoutDirectory", + { path }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type DiffStat in the environment - * @param name The name of the binding - * @param value The DiffStat value to assign to the binding - * @param description The purpose of the input + * Return a snapshot with a file removed + * @param path Path of the file to remove (e.g., "/file.txt"). */ - withDiffStatInput = (name: string, value: DiffStat, description: string): Env => { + withoutFile = (path: string): Directory => { const ctx = this._ctx.select( - "withDiffStatInput", - { name, value, description }, + "withoutFile", + { path }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Declare a desired DiffStat output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Return a snapshot with files removed + * @param paths Paths of the files to remove (e.g., ["/file.txt"]). */ - withDiffStatOutput = (name: string, description: string): Env => { + withoutFiles = (paths: string[]): Directory => { const ctx = this._ctx.select( - "withDiffStatOutput", - { name, description }, + "withoutFiles", + { paths }, ) - return new Env(ctx) + return new Directory(ctx) } /** - * Create or update a binding of type Directory in the environment - * @param name The name of the binding - * @param value The Directory value to assign to the binding - * @param description The purpose of the input + * Call the provided function with current Directory. + * + * This is useful for reusability and readability by not breaking the calling chain. */ - withDirectoryInput = (name: string, value: Directory, description: string): Env => { - - const ctx = this._ctx.select( - "withDirectoryInput", - { name, value, description }, - ) - return new Env(ctx) + with = (arg: (param: Directory) => Directory) => { + return arg(this) } +} + +/** + * The Dagger engine configuration and state + */ +export class Engine extends BaseClient { + private readonly _id?: ID = undefined + private readonly _name?: string = undefined /** - * Declare a desired Directory output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withDirectoryOutput = (name: string, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _name?: string, + ) { + super(ctx) - const ctx = this._ctx.select( - "withDirectoryOutput", - { name, description }, - ) - return new Env(ctx) - } + this._id = _id + this._name = _name + } /** - * Create or update a binding of type EnvFile in the environment - * @param name The name of the binding - * @param value The EnvFile value to assign to the binding - * @param description The purpose of the input + * A unique identifier for this Engine. */ - withEnvFileInput = (name: string, value: EnvFile, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withEnvFileInput", - { name, value, description }, + "id", ) - return new Env(ctx) - } - /** - * Declare a desired EnvFile output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withEnvFileOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withEnvFileOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type Env in the environment - * @param name The name of the binding - * @param value The Env value to assign to the binding - * @param description The purpose of the input + * The list of connected client IDs */ - withEnvInput = (name: string, value: Env, description: string): Env => { - + clients = async (): Promise => { const ctx = this._ctx.select( - "withEnvInput", - { name, value, description }, + "clients", ) - return new Env(ctx) - } - /** - * Declare a desired Env output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withEnvOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withEnvOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type File in the environment - * @param name The name of the binding - * @param value The File value to assign to the binding - * @param description The purpose of the input + * The local engine cache state tracked by dagql */ - withFileInput = (name: string, value: File, description: string): Env => { + localCache = (): EngineCache => { const ctx = this._ctx.select( - "withFileInput", - { name, value, description }, + "localCache", ) - return new Env(ctx) + return new EngineCache(ctx) } /** - * Declare a desired File output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The name of the engine instance. */ - withFileOutput = (name: string, description: string): Env => { + name = async (): Promise => { + if (this._name) { + return this._name + } const ctx = this._ctx.select( - "withFileOutput", - { name, description }, + "name", ) - return new Env(ctx) - } - /** - * Create or update a binding of type GeneratorGroup in the environment - * @param name The name of the binding - * @param value The GeneratorGroup value to assign to the binding - * @param description The purpose of the input - */ - withGeneratorGroupInput = (name: string, value: GeneratorGroup, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withGeneratorGroupInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } +} + +/** + * A cache storage for the Dagger engine + */ +export class EngineCache extends BaseClient { + private readonly _id?: ID = undefined + private readonly _maxUsedSpace?: number = undefined + private readonly _minFreeSpace?: number = undefined + private readonly _prune?: Void = undefined + private readonly _reservedSpace?: number = undefined + private readonly _targetSpace?: number = undefined /** - * Declare a desired GeneratorGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withGeneratorGroupOutput = (name: string, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _maxUsedSpace?: number, + _minFreeSpace?: number, + _prune?: Void, + _reservedSpace?: number, + _targetSpace?: number, + ) { + super(ctx) - const ctx = this._ctx.select( - "withGeneratorGroupOutput", - { name, description }, - ) - return new Env(ctx) - } + this._id = _id + this._maxUsedSpace = _maxUsedSpace + this._minFreeSpace = _minFreeSpace + this._prune = _prune + this._reservedSpace = _reservedSpace + this._targetSpace = _targetSpace + } /** - * Create or update a binding of type Generator in the environment - * @param name The name of the binding - * @param value The Generator value to assign to the binding - * @param description The purpose of the input + * A unique identifier for this EngineCache. */ - withGeneratorInput = (name: string, value: Generator, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withGeneratorInput", - { name, value, description }, + "id", ) - return new Env(ctx) - } - /** - * Declare a desired Generator output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withGeneratorOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withGeneratorOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type GitRef in the environment - * @param name The name of the binding - * @param value The GitRef value to assign to the binding - * @param description The purpose of the input + * The current set of entries in the cache */ - withGitRefInput = (name: string, value: GitRef, description: string): Env => { + entrySet = (opts?: EngineCacheEntrySetOpts): EngineCacheEntrySet => { const ctx = this._ctx.select( - "withGitRefInput", - { name, value, description }, + "entrySet", + { ...opts }, ) - return new Env(ctx) + return new EngineCacheEntrySet(ctx) } /** - * Declare a desired GitRef output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The maximum bytes to keep in the cache without pruning. */ - withGitRefOutput = (name: string, description: string): Env => { + maxUsedSpace = async (): Promise => { + if (this._maxUsedSpace) { + return this._maxUsedSpace + } const ctx = this._ctx.select( - "withGitRefOutput", - { name, description }, + "maxUsedSpace", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Create or update a binding of type GitRepository in the environment - * @param name The name of the binding - * @param value The GitRepository value to assign to the binding - * @param description The purpose of the input + * The target amount of free disk space the garbage collector will attempt to leave. */ - withGitRepositoryInput = (name: string, value: GitRepository, description: string): Env => { + minFreeSpace = async (): Promise => { + if (this._minFreeSpace) { + return this._minFreeSpace + } const ctx = this._ctx.select( - "withGitRepositoryInput", - { name, value, description }, + "minFreeSpace", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Declare a desired GitRepository output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Prune the cache of releaseable entries + * @param opts.useDefaultPolicy Use enabled engine-wide default disk and structural policies. If no default disk policy is enabled, the disk stage falls back to pruning all releasable disk-cache entries. If false, explicit options select stages; with no options, all releasable disk-cache entries are pruned. + * @param opts.maxUsedSpace Override the maximum disk space to keep before pruning (e.g. "200GB" or "80%"). + * @param opts.reservedSpace Override the minimum disk space to retain during pruning (e.g. "500GB" or "10%"). + * @param opts.minFreeSpace Override the minimum free disk space target during pruning (e.g. "20GB" or "20%"). + * @param opts.targetSpace Override the target disk space to keep after pruning (e.g. "200GB" or "50%"). + * @param opts.maxEstimatedBytes Override the maximum structural metadata estimate in absolute bytes. Explicit values must be positive; the configured/default value is used when omitted. + * @param opts.targetEstimatedBytes Override the structural metadata estimate to target in absolute bytes. Explicit values must be positive and lower than the resolved maximum; the configured/default value is used when omitted. */ - withGitRepositoryOutput = (name: string, description: string): Env => { + prune = async ( + opts?: EngineCachePruneOpts): Promise => { + if (this._prune) { + return + } const ctx = this._ctx.select( - "withGitRepositoryOutput", - { name, description }, + "prune", + { ...opts}, ) - return new Env(ctx) + + await ctx.execute() + + } /** - * Create or update a binding of type HTTPState in the environment - * @param name The name of the binding - * @param value The HTTPState value to assign to the binding - * @param description The purpose of the input + * The minimum amount of disk space this policy is guaranteed to retain. */ - withHTTPStateInput = (name: string, value: HTTPState, description: string): Env => { + reservedSpace = async (): Promise => { + if (this._reservedSpace) { + return this._reservedSpace + } const ctx = this._ctx.select( - "withHTTPStateInput", - { name, value, description }, + "reservedSpace", ) - return new Env(ctx) - } - /** - * Declare a desired HTTPState output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withHTTPStateOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withHTTPStateOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type JSONValue in the environment - * @param name The name of the binding - * @param value The JSONValue value to assign to the binding - * @param description The purpose of the input + * The target number of bytes to keep when pruning. */ - withJSONValueInput = (name: string, value: JSONValue, description: string): Env => { + targetSpace = async (): Promise => { + if (this._targetSpace) { + return this._targetSpace + } const ctx = this._ctx.select( - "withJSONValueInput", - { name, value, description }, + "targetSpace", ) - return new Env(ctx) - } - /** - * Declare a desired JSONValue output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withJSONValueOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withJSONValueOutput", - { name, description }, - ) - return new Env(ctx) + + return response } +} + +/** + * An individual cache entry in a cache entry set + */ +export class EngineCacheEntry extends BaseClient { + private readonly _id?: ID = undefined + private readonly _activelyUsed?: boolean = undefined + private readonly _createdTimeUnixNano?: number = undefined + private readonly _dagqlCall?: string = undefined + private readonly _description?: string = undefined + private readonly _diskSpaceBytes?: number = undefined + private readonly _mostRecentUseTimeUnixNano?: number = undefined + private readonly _recordType?: string = undefined /** - * Create or update a binding of type LLMContentBlock in the environment - * @param name The name of the binding - * @param value The LLMContentBlock value to assign to the binding - * @param description The purpose of the input + * Constructor is used for internal usage only, do not create object from it. */ - withLLMContentBlockInput = (name: string, value: LLMContentBlock, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _activelyUsed?: boolean, + _createdTimeUnixNano?: number, + _dagqlCall?: string, + _description?: string, + _diskSpaceBytes?: number, + _mostRecentUseTimeUnixNano?: number, + _recordType?: string, + ) { + super(ctx) - const ctx = this._ctx.select( - "withLLMContentBlockInput", - { name, value, description }, - ) - return new Env(ctx) - } + this._id = _id + this._activelyUsed = _activelyUsed + this._createdTimeUnixNano = _createdTimeUnixNano + this._dagqlCall = _dagqlCall + this._description = _description + this._diskSpaceBytes = _diskSpaceBytes + this._mostRecentUseTimeUnixNano = _mostRecentUseTimeUnixNano + this._recordType = _recordType + } /** - * Declare a desired LLMContentBlock output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * A unique identifier for this EngineCacheEntry. */ - withLLMContentBlockOutput = (name: string, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withLLMContentBlockOutput", - { name, description }, + "id", ) - return new Env(ctx) - } - /** - * Create or update a binding of type LLMMessage in the environment - * @param name The name of the binding - * @param value The LLMMessage value to assign to the binding - * @param description The purpose of the input - */ - withLLMMessageInput = (name: string, value: LLMMessage, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withLLMMessageInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired LLMMessage output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Whether the cache entry is actively being used. */ - withLLMMessageOutput = (name: string, description: string): Env => { + activelyUsed = async (): Promise => { + if (this._activelyUsed) { + return this._activelyUsed + } const ctx = this._ctx.select( - "withLLMMessageOutput", - { name, description }, + "activelyUsed", ) - return new Env(ctx) - } - /** - * Sets the main module for this environment (the project being worked on) - * - * Contextual path arguments will be populated using the environment's workspace. - */ - withMainModule = (module_: Module_): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withMainModule", - { - module:module_ }, - ) - return new Env(ctx) + + return response } /** - * Installs a module into the environment, exposing its functions to the model - * - * Contextual path arguments will be populated using the environment's workspace. - * @deprecated Use withMainModule instead + * The time the cache entry was created, in Unix nanoseconds. */ - withModule = (module_: Module_): Env => { + createdTimeUnixNano = async (): Promise => { + if (this._createdTimeUnixNano) { + return this._createdTimeUnixNano + } const ctx = this._ctx.select( - "withModule", - { - module:module_ }, + "createdTimeUnixNano", ) - return new Env(ctx) - } - /** - * Create or update a binding of type ModuleConfigClient in the environment - * @param name The name of the binding - * @param value The ModuleConfigClient value to assign to the binding - * @param description The purpose of the input - */ - withModuleConfigClientInput = (name: string, value: ModuleConfigClient, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withModuleConfigClientInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired ModuleConfigClient output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The DagQL call that produced this cache entry. */ - withModuleConfigClientOutput = (name: string, description: string): Env => { + dagqlCall = async (): Promise => { + if (this._dagqlCall) { + return this._dagqlCall + } const ctx = this._ctx.select( - "withModuleConfigClientOutput", - { name, description }, + "dagqlCall", ) - return new Env(ctx) - } - /** - * Create or update a binding of type Module in the environment - * @param name The name of the binding - * @param value The Module value to assign to the binding - * @param description The purpose of the input - */ - withModuleInput = (name: string, value: Module_, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withModuleInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired Module output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The description of the cache entry. */ - withModuleOutput = (name: string, description: string): Env => { + description = async (): Promise => { + if (this._description) { + return this._description + } const ctx = this._ctx.select( - "withModuleOutput", - { name, description }, + "description", ) - return new Env(ctx) - } - /** - * Create or update a binding of type ModuleSource in the environment - * @param name The name of the binding - * @param value The ModuleSource value to assign to the binding - * @param description The purpose of the input - */ - withModuleSourceInput = (name: string, value: ModuleSource, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withModuleSourceInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired ModuleSource output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The disk space used by the cache entry. */ - withModuleSourceOutput = (name: string, description: string): Env => { + diskSpaceBytes = async (): Promise => { + if (this._diskSpaceBytes) { + return this._diskSpaceBytes + } const ctx = this._ctx.select( - "withModuleSourceOutput", - { name, description }, + "diskSpaceBytes", ) - return new Env(ctx) - } - /** - * Create or update a binding of type Schema in the environment - * @param name The name of the binding - * @param value The Schema value to assign to the binding - * @param description The purpose of the input - */ - withSchemaInput = (name: string, value: Schema, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withSchemaInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired Schema output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The most recent time the cache entry was used, in Unix nanoseconds. */ - withSchemaOutput = (name: string, description: string): Env => { + mostRecentUseTimeUnixNano = async (): Promise => { + if (this._mostRecentUseTimeUnixNano) { + return this._mostRecentUseTimeUnixNano + } const ctx = this._ctx.select( - "withSchemaOutput", - { name, description }, + "mostRecentUseTimeUnixNano", ) - return new Env(ctx) - } - /** - * Create or update a binding of type SearchResult in the environment - * @param name The name of the binding - * @param value The SearchResult value to assign to the binding - * @param description The purpose of the input - */ - withSearchResultInput = (name: string, value: SearchResult, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withSearchResultInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired SearchResult output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The type of the cache record (e.g. regular, internal, frontend, source.local, source.git.checkout, exec.cachemount). */ - withSearchResultOutput = (name: string, description: string): Env => { + recordType = async (): Promise => { + if (this._recordType) { + return this._recordType + } const ctx = this._ctx.select( - "withSearchResultOutput", - { name, description }, + "recordType", ) - return new Env(ctx) - } - /** - * Create or update a binding of type SearchSubmatch in the environment - * @param name The name of the binding - * @param value The SearchSubmatch value to assign to the binding - * @param description The purpose of the input - */ - withSearchSubmatchInput = (name: string, value: SearchSubmatch, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withSearchSubmatchInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired SearchSubmatch output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The storage record types represented by this cache entry. */ - withSearchSubmatchOutput = (name: string, description: string): Env => { - + recordTypes = async (): Promise => { const ctx = this._ctx.select( - "withSearchSubmatchOutput", - { name, description }, + "recordTypes", ) - return new Env(ctx) - } - /** - * Create or update a binding of type Secret in the environment - * @param name The name of the binding - * @param value The Secret value to assign to the binding - * @param description The purpose of the input - */ - withSecretInput = (name: string, value: Secret, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withSecretInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } +} + +/** + * A set of cache entries returned by a query to a cache + */ +export class EngineCacheEntrySet extends BaseClient { + private readonly _id?: ID = undefined + private readonly _diskSpaceBytes?: number = undefined + private readonly _entryCount?: number = undefined /** - * Declare a desired Secret output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withSecretOutput = (name: string, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _diskSpaceBytes?: number, + _entryCount?: number, + ) { + super(ctx) - const ctx = this._ctx.select( - "withSecretOutput", - { name, description }, - ) - return new Env(ctx) - } + this._id = _id + this._diskSpaceBytes = _diskSpaceBytes + this._entryCount = _entryCount + } /** - * Create or update a binding of type Service in the environment - * @param name The name of the binding - * @param value The Service value to assign to the binding - * @param description The purpose of the input + * A unique identifier for this EngineCacheEntrySet. */ - withServiceInput = (name: string, value: Service, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withServiceInput", - { name, value, description }, + "id", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Declare a desired Service output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The total disk space used by the cache entries in this set. */ - withServiceOutput = (name: string, description: string): Env => { + diskSpaceBytes = async (): Promise => { + if (this._diskSpaceBytes) { + return this._diskSpaceBytes + } const ctx = this._ctx.select( - "withServiceOutput", - { name, description }, + "diskSpaceBytes", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Create or update a binding of type Socket in the environment - * @param name The name of the binding - * @param value The Socket value to assign to the binding - * @param description The purpose of the input + * The list of individual cache entries in the set */ - withSocketInput = (name: string, value: Socket, description: string): Env => { + entries = async (): Promise => { + type entries = { + id: ID + } const ctx = this._ctx.select( - "withSocketInput", - { name, value, description }, - ) - return new Env(ctx) + "entries", + ).select("id") + + const response: Awaited = await ctx.execute() + + + return response.map((r) => new EngineCacheEntry(ctx.copy().selectNode(r.id, "EngineCacheEntry"))) } /** - * Declare a desired Socket output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The number of cache entries in this set. */ - withSocketOutput = (name: string, description: string): Env => { + entryCount = async (): Promise => { + if (this._entryCount) { + return this._entryCount + } const ctx = this._ctx.select( - "withSocketOutput", - { name, description }, + "entryCount", ) - return new Env(ctx) - } - /** - * Create or update a binding of type Stat in the environment - * @param name The name of the binding - * @param value The Stat value to assign to the binding - * @param description The purpose of the input - */ - withStatInput = (name: string, value: Stat, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withStatInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } +} + +/** + * A definition of a custom enum defined in a Module. + */ +export class EnumTypeDef extends BaseClient { + private readonly _id?: ID = undefined + private readonly _description?: string = undefined + private readonly _name?: string = undefined + private readonly _sourceModuleName?: string = undefined /** - * Declare a desired Stat output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * Constructor is used for internal usage only, do not create object from it. */ - withStatOutput = (name: string, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _description?: string, + _name?: string, + _sourceModuleName?: string, + ) { + super(ctx) - const ctx = this._ctx.select( - "withStatOutput", - { name, description }, - ) - return new Env(ctx) - } + this._id = _id + this._description = _description + this._name = _name + this._sourceModuleName = _sourceModuleName + } /** - * Provides a string input binding to the environment - * @param name The name of the binding - * @param value The string value to assign to the binding - * @param description The description of the input + * A unique identifier for this EnumTypeDef. */ - withStringInput = (name: string, value: string, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withStringInput", - { name, value, description }, + "id", ) - return new Env(ctx) - } - /** - * Declares a desired string output binding - * @param name The name of the binding - * @param description The description of the output - */ - withStringOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withStringOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type UpGroup in the environment - * @param name The name of the binding - * @param value The UpGroup value to assign to the binding - * @param description The purpose of the input + * A doc string for the enum, if any. */ - withUpGroupInput = (name: string, value: UpGroup, description: string): Env => { + description = async (): Promise => { + if (this._description) { + return this._description + } const ctx = this._ctx.select( - "withUpGroupInput", - { name, value, description }, + "description", ) - return new Env(ctx) - } - /** - * Declare a desired UpGroup output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withUpGroupOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withUpGroupOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type Up in the environment - * @param name The name of the binding - * @param value The Up value to assign to the binding - * @param description The purpose of the input + * The members of the enum. */ - withUpInput = (name: string, value: Up, description: string): Env => { + members = async (): Promise => { + type members = { + id: ID + } const ctx = this._ctx.select( - "withUpInput", - { name, value, description }, - ) - return new Env(ctx) - } + "members", + ).select("id") - /** - * Declare a desired Up output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withUpOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withUpOutput", - { name, description }, - ) - return new Env(ctx) + + return response.map((r) => new EnumValueTypeDef(ctx.copy().selectNode(r.id, "EnumValueTypeDef"))) } /** - * Create or update a binding of type Volume in the environment - * @param name The name of the binding - * @param value The Volume value to assign to the binding - * @param description The purpose of the input + * The name of the enum. */ - withVolumeInput = (name: string, value: Volume, description: string): Env => { + name = async (): Promise => { + if (this._name) { + return this._name + } const ctx = this._ctx.select( - "withVolumeInput", - { name, value, description }, + "name", ) - return new Env(ctx) - } - /** - * Declare a desired Volume output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withVolumeOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withVolumeOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Returns a new environment with the provided workspace - * @param workspace The directory to set as the host filesystem + * The location of this enum declaration. */ - withWorkspace = (workspace: Directory): Env => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( - "withWorkspace", - { workspace }, - ) - return new Env(ctx) - } + "sourceMap", + ).select("id") - /** - * Create or update a binding of type WorkspaceGit in the environment - * @param name The name of the binding - * @param value The WorkspaceGit value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceGitInput = (name: string, value: WorkspaceGit, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceGitInput", - { name, value, description }, - ) - return new Env(ctx) + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** - * Declare a desired WorkspaceGit output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * If this EnumTypeDef is associated with a Module, the name of the module. Unset otherwise. */ - withWorkspaceGitOutput = (name: string, description: string): Env => { + sourceModuleName = async (): Promise => { + if (this._sourceModuleName) { + return this._sourceModuleName + } const ctx = this._ctx.select( - "withWorkspaceGitOutput", - { name, description }, + "sourceModuleName", ) - return new Env(ctx) - } - /** - * Create or update a binding of type Workspace in the environment - * @param name The name of the binding - * @param value The Workspace value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceInput = (name: string, value: Workspace, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type WorkspaceMigration in the environment - * @param name The name of the binding - * @param value The WorkspaceMigration value to assign to the binding - * @param description The purpose of the input + * The members of the enum. + * @deprecated use members instead */ - withWorkspaceMigrationInput = (name: string, value: WorkspaceMigration, description: string): Env => { + values = async (): Promise => { + type values = { + id: ID + } const ctx = this._ctx.select( - "withWorkspaceMigrationInput", - { name, value, description }, - ) - return new Env(ctx) - } + "values", + ).select("id") - /** - * Declare a desired WorkspaceMigration output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceMigrationOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceMigrationOutput", - { name, description }, - ) - return new Env(ctx) + + return response.map((r) => new EnumValueTypeDef(ctx.copy().selectNode(r.id, "EnumValueTypeDef"))) } +} + +/** + * A definition of a value in a custom enum defined in a Module. + */ +export class EnumValueTypeDef extends BaseClient { + private readonly _id?: ID = undefined + private readonly _deprecated?: string = undefined + private readonly _description?: string = undefined + private readonly _name?: string = undefined + private readonly _value?: string = undefined /** - * Create or update a binding of type WorkspaceMigrationStep in the environment - * @param name The name of the binding - * @param value The WorkspaceMigrationStep value to assign to the binding - * @param description The purpose of the input + * Constructor is used for internal usage only, do not create object from it. */ - withWorkspaceMigrationStepInput = (name: string, value: WorkspaceMigrationStep, description: string): Env => { + constructor( + ctx?: Context, + _id?: ID, + _deprecated?: string, + _description?: string, + _name?: string, + _value?: string, + ) { + super(ctx) - const ctx = this._ctx.select( - "withWorkspaceMigrationStepInput", - { name, value, description }, - ) - return new Env(ctx) - } + this._id = _id + this._deprecated = _deprecated + this._description = _description + this._name = _name + this._value = _value + } /** - * Declare a desired WorkspaceMigrationStep output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * A unique identifier for this EnumValueTypeDef. */ - withWorkspaceMigrationStepOutput = (name: string, description: string): Env => { + id = async (): Promise => { + if (this._id) { + return this._id + } const ctx = this._ctx.select( - "withWorkspaceMigrationStepOutput", - { name, description }, + "id", ) - return new Env(ctx) - } - /** - * Create or update a binding of type WorkspaceModule in the environment - * @param name The name of the binding - * @param value The WorkspaceModule value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceModuleInput = (name: string, value: WorkspaceModule, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceModuleInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired WorkspaceModule output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The reason this enum member is deprecated, if any. */ - withWorkspaceModuleOutput = (name: string, description: string): Env => { + deprecated = async (): Promise => { + if (this._deprecated) { + return this._deprecated + } const ctx = this._ctx.select( - "withWorkspaceModuleOutput", - { name, description }, + "deprecated", ) - return new Env(ctx) - } - /** - * Create or update a binding of type WorkspaceModuleSetting in the environment - * @param name The name of the binding - * @param value The WorkspaceModuleSetting value to assign to the binding - * @param description The purpose of the input - */ - withWorkspaceModuleSettingInput = (name: string, value: WorkspaceModuleSetting, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceModuleSettingInput", - { name, value, description }, - ) - return new Env(ctx) + + return response } /** - * Declare a desired WorkspaceModuleSetting output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * A doc string for the enum member, if any. */ - withWorkspaceModuleSettingOutput = (name: string, description: string): Env => { + description = async (): Promise => { + if (this._description) { + return this._description + } const ctx = this._ctx.select( - "withWorkspaceModuleSettingOutput", - { name, description }, + "description", ) - return new Env(ctx) - } - /** - * Declare a desired Workspace output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding - */ - withWorkspaceOutput = (name: string, description: string): Env => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "withWorkspaceOutput", - { name, description }, - ) - return new Env(ctx) + + return response } /** - * Create or update a binding of type WorkspaceSDK in the environment - * @param name The name of the binding - * @param value The WorkspaceSDK value to assign to the binding - * @param description The purpose of the input + * The name of the enum member. */ - withWorkspaceSDKInput = (name: string, value: WorkspaceSDK, description: string): Env => { + name = async (): Promise => { + if (this._name) { + return this._name + } const ctx = this._ctx.select( - "withWorkspaceSDKInput", - { name, value, description }, + "name", ) - return new Env(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** - * Declare a desired WorkspaceSDK output to be assigned in the environment - * @param name The name of the binding - * @param description A description of the desired value of the binding + * The location of this enum member declaration. */ - withWorkspaceSDKOutput = (name: string, description: string): Env => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( - "withWorkspaceSDKOutput", - { name, description }, - ) - return new Env(ctx) + "sourceMap", + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** - * Returns a new environment without any outputs + * The value of the enum member */ - withoutOutputs = (): Env => { + value = async (): Promise => { + if (this._value) { + return this._value + } const ctx = this._ctx.select( - "withoutOutputs", + "value", ) - return new Env(ctx) - } - workspace = (): Directory => { - const ctx = this._ctx.select( - "workspace", - ) - return new Directory(ctx) - } + const response: Awaited = await ctx.execute() - /** - * Call the provided function with current Env. - * - * This is useful for reusability and readability by not breaking the calling chain. - */ - with = (arg: (param: Env) => Env) => { - return arg(this) + + return response } } @@ -10449,12 +8691,17 @@ export class FieldTypeDef extends BaseClient { /** * The location of this field declaration. */ - sourceMap = (): SourceMap => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( "sourceMap", - ) - return new SourceMap(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** @@ -10699,12 +8946,17 @@ export class File extends BaseClient { /** * Return file status */ - stat = (): Stat => { - + stat = async (): Promise => { const ctx = this._ctx.select( "stat", - ) - return new Stat(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Stat(ctx.copy().selectNode(response, "Stat")) } /** @@ -10923,12 +9175,17 @@ export class Function_ extends BaseClient { /** * The location of this function declaration. */ - sourceMap = (): SourceMap => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( "sourceMap", - ) - return new SourceMap(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** @@ -10949,6 +9206,17 @@ export class Function_ extends BaseClient { return response } + /** + * Returns the function with a flag indicating it is an agent middleware. + */ + withAgent = (): Function_ => { + + const ctx = this._ctx.select( + "withAgent", + ) + return new Function_(ctx) + } + /** * Returns the function with the provided argument * @param name The name of the argument @@ -11250,12 +9518,17 @@ export class FunctionArg extends BaseClient { /** * The location of this arg declaration. */ - sourceMap = (): SourceMap => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( "sourceMap", - ) - return new SourceMap(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** @@ -11928,12 +10201,349 @@ export class GeneratorGroup extends BaseClient { } } +/** + * An immutable git commit. + */ +export class GitCommit extends BaseClient { + private readonly _id?: ID = undefined + private readonly _authorEmail?: string = undefined + private readonly _authorName?: string = undefined + private readonly _authoredDate?: string = undefined + private readonly _committedDate?: string = undefined + private readonly _committerEmail?: string = undefined + private readonly _committerName?: string = undefined + private readonly _message?: string = undefined + private readonly _messageBody?: string = undefined + private readonly _messageHeadline?: string = undefined + private readonly _sha?: string = undefined + private readonly _shortSha?: string = undefined + + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor( + ctx?: Context, + _id?: ID, + _authorEmail?: string, + _authorName?: string, + _authoredDate?: string, + _committedDate?: string, + _committerEmail?: string, + _committerName?: string, + _message?: string, + _messageBody?: string, + _messageHeadline?: string, + _sha?: string, + _shortSha?: string, + ) { + super(ctx) + + this._id = _id + this._authorEmail = _authorEmail + this._authorName = _authorName + this._authoredDate = _authoredDate + this._committedDate = _committedDate + this._committerEmail = _committerEmail + this._committerName = _committerName + this._message = _message + this._messageBody = _messageBody + this._messageHeadline = _messageHeadline + this._sha = _sha + this._shortSha = _shortSha + } + + /** + * A unique identifier for this GitCommit. + */ + id = async (): Promise => { + if (this._id) { + return this._id + } + + const ctx = this._ctx.select( + "id", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * The latest semver release tag reachable from this commit. + * @param opts.includePreRelease Include pre-release tags when choosing the latest tag. + */ + ancestorReleaseTag = async ( + opts?: GitCommitAncestorReleaseTagOpts): Promise => { + const ctx = this._ctx.select( + "ancestorReleaseTag", + { ...opts}, + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")) + } + + /** + * Git author email. + */ + authorEmail = async (): Promise => { + if (this._authorEmail) { + return this._authorEmail + } + + const ctx = this._ctx.select( + "authorEmail", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Git author name. + */ + authorName = async (): Promise => { + if (this._authorName) { + return this._authorName + } + + const ctx = this._ctx.select( + "authorName", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Git author date, in RFC3339 format. + */ + authoredDate = async (): Promise => { + if (this._authoredDate) { + return this._authoredDate + } + + const ctx = this._ctx.select( + "authoredDate", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Git committer date, in RFC3339 format. + */ + committedDate = async (): Promise => { + if (this._committedDate) { + return this._committedDate + } + + const ctx = this._ctx.select( + "committedDate", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Git committer email. + */ + committerEmail = async (): Promise => { + if (this._committerEmail) { + return this._committerEmail + } + + const ctx = this._ctx.select( + "committerEmail", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Git committer name. + */ + committerName = async (): Promise => { + if (this._committerName) { + return this._committerName + } + + const ctx = this._ctx.select( + "committerName", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Full commit message. + */ + message = async (): Promise => { + if (this._message) { + return this._message + } + + const ctx = this._ctx.select( + "message", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Commit message body, excluding the headline. + */ + messageBody = async (): Promise => { + if (this._messageBody) { + return this._messageBody + } + + const ctx = this._ctx.select( + "messageBody", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * First line of the commit message. + */ + messageHeadline = async (): Promise => { + if (this._messageHeadline) { + return this._messageHeadline + } + + const ctx = this._ctx.select( + "messageHeadline", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * Parent commit SHAs. + */ + parentShas = async (): Promise => { + const ctx = this._ctx.select( + "parentShas", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * The latest semver release tag that points directly at this commit. + * @param opts.includePreRelease Include pre-release tags when choosing the latest tag. + */ + releaseTag = async ( + opts?: GitCommitReleaseTagOpts): Promise => { + const ctx = this._ctx.select( + "releaseTag", + { ...opts}, + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new GitRef(ctx.copy().selectNode(response, "GitRef")) + } + + /** + * The full commit SHA. + */ + sha = async (): Promise => { + if (this._sha) { + return this._sha + } + + const ctx = this._ctx.select( + "sha", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * The abbreviated commit SHA. + */ + shortSha = async (): Promise => { + if (this._shortSha) { + return this._shortSha + } + + const ctx = this._ctx.select( + "shortSha", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * The filesystem tree at this commit. + * @param opts.discardGitDir Set to true to discard .git directory. + * @param opts.depth The depth of the tree to fetch. + * @param opts.includeTags Set to true to populate tag refs in the local checkout .git. + */ + tree = (opts?: GitCommitTreeOpts): Directory => { + + const ctx = this._ctx.select( + "tree", + { ...opts }, + ) + return new Directory(ctx) + } +} + /** * A git ref (tag, branch, or commit). */ export class GitRef extends BaseClient { private readonly _id?: ID = undefined private readonly _commit?: string = undefined + private readonly _commitSHA?: string = undefined + private readonly _name?: string = undefined private readonly _ref?: string = undefined /** @@ -11943,12 +10553,16 @@ export class GitRef extends BaseClient { ctx?: Context, _id?: ID, _commit?: string, + _commitSHA?: string, + _name?: string, _ref?: string, ) { super(ctx) this._id = _id this._commit = _commit + this._commitSHA = _commitSHA + this._name = _name this._ref = _ref } @@ -11985,6 +10599,7 @@ export class GitRef extends BaseClient { /** * The resolved commit id at this ref. + * @deprecated Use "commitSHA" instead. */ commit = async (): Promise => { if (this._commit) { @@ -12001,6 +10616,24 @@ export class GitRef extends BaseClient { return response } + /** + * The resolved commit SHA at this ref. + */ + commitSHA = async (): Promise => { + if (this._commitSHA) { + return this._commitSHA + } + + const ctx = this._ctx.select( + "commitSHA", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + /** * Find the best common ancestor between this ref and another ref. * @param other The other ref to compare against. @@ -12014,8 +10647,50 @@ export class GitRef extends BaseClient { return new GitRef(ctx) } + /** + * Commits reachable from this ref, newest first, starting with the commit this ref resolves to. + * @param opts.limit Maximum number of commits to return. + * @param opts.paths Only include commits touching these paths, relative to the root of the repository. + * @param opts.base Exclude commits reachable from this ref, i.e. only list commits added on top of it. + */ + log = async ( + opts?: GitRefLogOpts): Promise => { + type log = { + id: ID + } + + const ctx = this._ctx.select( + "log", + { ...opts}, + ).select("id") + + const response: Awaited = await ctx.execute() + + + return response.map((r) => new GitCommit(ctx.copy().selectNode(r.id, "GitCommit"))) + } + + /** + * The resolved name of this ref. + */ + name = async (): Promise => { + if (this._name) { + return this._name + } + + const ctx = this._ctx.select( + "name", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + /** * The resolved ref name at this ref. + * @deprecated Use "name" instead. */ ref = async (): Promise => { if (this._ref) { @@ -12032,6 +10707,17 @@ export class GitRef extends BaseClient { return response } + /** + * The commit this ref resolves to. + */ + targetCommit = (): GitCommit => { + + const ctx = this._ctx.select( + "targetCommit", + ) + return new GitCommit(ctx) + } + /** * The filesystem tree at this ref. * @param opts.discardGitDir Set to true to discard .git directory. @@ -12143,13 +10829,13 @@ export class GitRepository extends BaseClient { * Returns details of a commit. * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b"). */ - commit = (id: string): GitRef => { + commit = (id: string): GitCommit => { const ctx = this._ctx.select( "commit", { id }, ) - return new GitRef(ctx) + return new GitCommit(ctx) } /** @@ -12809,12 +11495,17 @@ export class InterfaceTypeDef extends BaseClient { /** * The location of this interface declaration. */ - sourceMap = (): SourceMap => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( "sourceMap", - ) - return new SourceMap(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** @@ -13086,12 +11777,14 @@ export class JSONValue extends BaseClient { */ export class LLM extends BaseClient { private readonly _id?: ID = undefined + private readonly _contextTokens?: number = undefined private readonly _contextWindow?: number = undefined private readonly _hasPending?: boolean = undefined private readonly _lastReply?: string = undefined private readonly _model?: string = undefined private readonly _portableID?: ID = undefined private readonly _provider?: string = undefined + private readonly _reasoningEffort?: string = undefined private readonly _replay?: ID = undefined private readonly _sync?: ID = undefined private readonly _tools?: string = undefined @@ -13103,12 +11796,14 @@ export class LLM extends BaseClient { constructor( ctx?: Context, _id?: ID, + _contextTokens?: number, _contextWindow?: number, _hasPending?: boolean, _lastReply?: string, _model?: string, _portableID?: ID, _provider?: string, + _reasoningEffort?: string, _replay?: ID, _sync?: ID, _tools?: string, @@ -13117,12 +11812,14 @@ export class LLM extends BaseClient { super(ctx) this._id = _id + this._contextTokens = _contextTokens this._contextWindow = _contextWindow this._hasPending = _hasPending this._lastReply = _lastReply this._model = _model this._portableID = _portableID this._provider = _provider + this._reasoningEffort = _reasoningEffort this._replay = _replay this._sync = _sync this._tools = _tools @@ -13148,15 +11845,21 @@ export class LLM extends BaseClient { } /** - * returns the type of the current state + * estimated number of tokens currently occupying the context window; unlike tokenUsage this is not cumulative over the session */ - bindResult = (name: string): Binding => { + contextTokens = async (): Promise => { + if (this._contextTokens) { + return this._contextTokens + } const ctx = this._ctx.select( - "bindResult", - { name }, + "contextTokens", ) - return new Binding(ctx) + + const response: Awaited = await ctx.execute() + + + return response } /** @@ -13177,17 +11880,6 @@ export class LLM extends BaseClient { return response } - /** - * return the LLM's current environment - */ - env = (): Env => { - - const ctx = this._ctx.select( - "env", - ) - return new Env(ctx) - } - /** * Fork the conversation, so that otherwise-identical follow-ups evaluate independently instead of deduplicating to a single cached result. * @param label A label distinguishing this fork from its siblings, e.g. "attempt-2" when retrying a flaky evaluation. @@ -13288,7 +11980,7 @@ export class LLM extends BaseClient { } /** - * A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. + * A portable, self-contained ID for the conversation that node() can resolve in any session. Unlike id, which may return an engine-local runtime handle valid only within the current session, this returns the recipe form suitable for persisting and later restoring the conversation. The recipe is flattened: bindings superseded during the session (workspace overlays recorded by each mutating tool call, and re-bound toolsets) are dropped, while the current workspace binding — including any pending, un-exported edits — is preserved. */ portableID = async (): Promise => { if (this._portableID) { @@ -13323,6 +12015,24 @@ export class LLM extends BaseClient { return response } + /** + * The reasoning effort in use, e.g. "low", "medium", or "high". Empty or "none" when reasoning is disabled. + */ + reasoningEffort = async (): Promise => { + if (this._reasoningEffort) { + return this._reasoningEffort + } + + const ctx = this._ctx.select( + "reasoningEffort", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + /** * Re-emit telemetry spans for the full message history, so a loaded conversation displays in the TUI. */ @@ -13337,6 +12047,24 @@ export class LLM extends BaseClient { return new LLM(ctx.copy().selectNode(response, "LLM")) } + /** + * The skills visible to the model, exactly as the ListSkills tool serves them: engine-embedded skills, skills installed with withSkills, and skills discovered in the workspace. + */ + skills = async (): Promise => { + type skills = { + id: ID + } + + const ctx = this._ctx.select( + "skills", + ).select("id") + + const response: Awaited = await ctx.execute() + + + return response.map((r) => new LLMSkill(ctx.copy().selectNode(r.id, "LLMSkill"))) + } + /** * Advance the conversation by a single step: send the queued prompt or tool results to the model, evaluate any tool calls it makes, and queue their results. Use loop to step until the model ends its turn. * @param opts.maxTokens Cap the model's output tokens for this step. Defaults to the model's maximum. @@ -13411,35 +12139,6 @@ export class LLM extends BaseClient { return response } - /** - * Return a new LLM with the specified function no longer exposed as a tool - * @param typeName The type name whose function will be blocked - * @param function The function to block - * - * Will be converted to lowerCamelCase if necessary. - */ - withBlockedFunction = (typeName: string, function_: string): LLM => { - - const ctx = this._ctx.select( - "withBlockedFunction", - { typeName, - function:function_ }, - ) - return new LLM(ctx) - } - - /** - * allow the LLM to interact with an environment via MCP - */ - withEnv = (env: Env): LLM => { - - const ctx = this._ctx.select( - "withEnv", - { env }, - ) - return new LLM(ctx) - } - /** * Add an external MCP server to the LLM * @param name The name of the MCP server @@ -13468,20 +12167,6 @@ export class LLM extends BaseClient { return new LLM(ctx) } - /** - * Track an object so the LLM can reference it in subsequent tool calls. - * @param tag Arbitrary string tag for the object, typically in TypeName#Number format - * @param object The object to track, as a generic ID - */ - withObject = (tag: string, object: ID): LLM => { - - const ctx = this._ctx.select( - "withObject", - { tag, object }, - ) - return new LLM(ctx) - } - /** * Queue a user prompt, to be sent to the model on the next step or loop. * @param prompt The prompt to send @@ -13508,6 +12193,19 @@ export class LLM extends BaseClient { return new LLM(ctx) } + /** + * Change the reasoning effort for the rest of the conversation, overriding any configured default. The message history is preserved; the new effort takes effect on the next step. + * @param effort The reasoning effort, e.g. "low", "medium", or "high"; "none" disables reasoning. Supported levels are model-specific — some models also accept e.g. "minimal", "xhigh", or "max". + */ + withReasoningEffort = (effort: string): LLM => { + + const ctx = this._ctx.select( + "withReasoningEffort", + { effort }, + ) + return new LLM(ctx) + } + /** * Append an assistant response to the message history without calling the model, e.g. to reconstruct a conversation from another source. * @param content The response content @@ -13527,12 +12225,14 @@ export class LLM extends BaseClient { } /** - * Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration + * Install skills from a directory, adding them to the skills the model discovers with ListSkills and reads with ReadSkill. Each skill is a directory containing a SKILL.md with name and description frontmatter, discovered anywhere in the tree. Installed skills take precedence over skills discovered in the workspace, but cannot shadow the engine's built-in skills. + * @param directory A directory containing skills, each a subdirectory holding a SKILL.md. */ - withStaticTools = (): LLM => { + withSkills = (directory: Directory): LLM => { const ctx = this._ctx.select( - "withStaticTools", + "withSkills", + { directory }, ) return new LLM(ctx) } @@ -13565,6 +12265,33 @@ export class LLM extends BaseClient { return new LLM(ctx) } + /** + * Expose an object's methods as tools. Every eligible method of the bound object becomes a tool; a tool that returns this object's own type replaces it as the new state. Repeatable to bind several objects. + * @param object The object whose methods become tools. + * @param opts.except Method names to exclude from the toolset (e.g. constructors, entrypoints). + */ + withTools = (object: Node, opts?: LLMWithToolsOpts): LLM => { + + const ctx = this._ctx.select( + "withTools", + { object, ...opts }, + ) + return new LLM(ctx) + } + + /** + * Bind the LLM to a workspace, exposing its modules as tools exactly as the Dagger CLI would serve them for that workspace. + * @param workspace The workspace to work in. + */ + withWorkspace = (workspace: Workspace): LLM => { + + const ctx = this._ctx.select( + "withWorkspace", + { workspace }, + ) + return new LLM(ctx) + } + /** * Disable the default system prompt */ @@ -13598,6 +12325,17 @@ export class LLM extends BaseClient { return new LLM(ctx) } + /** + * Return the workspace the LLM is bound to. + */ + workspace = (): Workspace => { + + const ctx = this._ctx.select( + "workspace", + ) + return new Workspace(ctx) + } + /** * Call the provided function with current LLM. * @@ -13798,9 +12536,98 @@ export class LLMContentBlock extends BaseClient { /** * A single message in an LLM conversation. */ -export class LLMMessage extends BaseClient { +export class LLMMessage extends BaseClient { + private readonly _id?: ID = undefined + private readonly _role?: LLMMessageRole = undefined + + /** + * Constructor is used for internal usage only, do not create object from it. + */ + constructor( + ctx?: Context, + _id?: ID, + _role?: LLMMessageRole, + ) { + super(ctx) + + this._id = _id + this._role = _role + } + + /** + * A unique identifier for this LLMMessage. + */ + id = async (): Promise => { + if (this._id) { + return this._id + } + + const ctx = this._ctx.select( + "id", + ) + + const response: Awaited = await ctx.execute() + + + return response + } + + /** + * The message's content blocks, in the order the model produced them. + */ + content = async (): Promise => { + type content = { + id: ID + } + + const ctx = this._ctx.select( + "content", + ).select("id") + + const response: Awaited = await ctx.execute() + + + return response.map((r) => new LLMContentBlock(ctx.copy().selectNode(r.id, "LLMContentBlock"))) + } + + /** + * The role that produced this message. + */ + role = async (): Promise => { + if (this._role) { + return this._role + } + + const ctx = this._ctx.select( + "role", + ) + + const response: Awaited = await ctx.execute() + + return LLMMessageRoleNameToValue(response) + } + + /** + * Token usage reported by the provider for the API call that produced this message; all zeros except on assistant responses. + */ + tokenUsage = (): LLMTokenUsage => { + + const ctx = this._ctx.select( + "tokenUsage", + ) + return new LLMTokenUsage(ctx) + } +} + + + +/** + * A skill available to a model: task-specific guidance discovered with ListSkills and read with ReadSkill. + */ +export class LLMSkill extends BaseClient { private readonly _id?: ID = undefined - private readonly _role?: LLMMessageRole = undefined + private readonly _description?: string = undefined + private readonly _name?: string = undefined /** * Constructor is used for internal usage only, do not create object from it. @@ -13808,16 +12635,18 @@ export class LLMMessage extends BaseClient { constructor( ctx?: Context, _id?: ID, - _role?: LLMMessageRole, + _description?: string, + _name?: string, ) { super(ctx) this._id = _id - this._role = _role + this._description = _description + this._name = _name } /** - * A unique identifier for this LLMMessage. + * A unique identifier for this LLMSkill. */ id = async (): Promise => { if (this._id) { @@ -13835,54 +12664,42 @@ export class LLMMessage extends BaseClient { } /** - * The message's content blocks, in the order the model produced them. + * The one-line description from the SKILL.md frontmatter. */ - content = async (): Promise => { - type content = { - id: ID + description = async (): Promise => { + if (this._description) { + return this._description } const ctx = this._ctx.select( - "content", - ).select("id") + "description", + ) - const response: Awaited = await ctx.execute() + const response: Awaited = await ctx.execute() - return response.map((r) => new LLMContentBlock(ctx.copy().selectNode(r.id, "LLMContentBlock"))) + return response } /** - * The role that produced this message. + * The skill name, as passed to ReadSkill. */ - role = async (): Promise => { - if (this._role) { - return this._role + name = async (): Promise => { + if (this._name) { + return this._name } const ctx = this._ctx.select( - "role", + "name", ) - const response: Awaited = await ctx.execute() - - return LLMMessageRoleNameToValue(response) - } - - /** - * Token usage reported by the provider for the API call that produced this message; all zeros except on assistant responses. - */ - tokenUsage = (): LLMTokenUsage => { + const response: Awaited = await ctx.execute() - const ctx = this._ctx.select( - "tokenUsage", - ) - return new LLMTokenUsage(ctx) + + return response } } - - /** * A count of tokens consumed by LLM API calls. */ @@ -14394,23 +13211,33 @@ export class Module_ extends BaseClient { /** * The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile. */ - runtime = (): Container => { - + runtime = async (): Promise => { const ctx = this._ctx.select( "runtime", - ) - return new Container(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Container(ctx.copy().selectNode(response, "Container")) } /** * The SDK config used by this module. */ - sdk = (): SDKConfig => { - + sdk = async (): Promise => { const ctx = this._ctx.select( "sdk", - ) - return new SDKConfig(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")) } /** @@ -14453,12 +13280,17 @@ export class Module_ extends BaseClient { /** * The source for the module. */ - source = (): ModuleSource => { - + source = async (): Promise => { const ctx = this._ctx.select( "source", - ) - return new ModuleSource(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new ModuleSource(ctx.copy().selectNode(response, "ModuleSource")) } /** @@ -14922,6 +13754,21 @@ export class ModuleSource extends BaseClient { return response } + /** + * Return the supplied workspace with this module's generated context applied. + * + * The workspace change baseline is preserved, so a later Workspace.changes call includes this generation together with any other edits made by the caller. + * @param workspace The workspace to apply generated files to. + */ + generate = (workspace: Workspace): Workspace => { + + const ctx = this._ctx.select( + "generate", + { workspace }, + ) + return new Workspace(ctx) + } + /** * Generate this module's transitive local dependency closure and return the staged changes as a single changeset against the unstaged workspace root. * @@ -15138,12 +13985,17 @@ export class ModuleSource extends BaseClient { /** * The SDK configuration of the module. */ - sdk = (): SDKConfig => { - + sdk = async (): Promise => { const ctx = this._ctx.select( "sdk", - ) - return new SDKConfig(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SDKConfig(ctx.copy().selectNode(response, "SDKConfig")) } /** @@ -15611,12 +14463,17 @@ export class ObjectTypeDef extends BaseClient { /** * The function used to construct new instances of this object, if any. */ - constructor_ = (): Function_ => { - + constructor_ = async (): Promise => { const ctx = this._ctx.select( "constructor", - ) - return new Function_(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new Function_(ctx.copy().selectNode(response, "Function")) } /** @@ -15712,12 +14569,17 @@ export class ObjectTypeDef extends BaseClient { /** * The location of this object declaration. */ - sourceMap = (): SourceMap => { - + sourceMap = async (): Promise => { const ctx = this._ctx.select( "sourceMap", - ) - return new SourceMap(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new SourceMap(ctx.copy().selectNode(response, "SourceMap")) } /** @@ -15743,6 +14605,8 @@ export class ObjectTypeDef extends BaseClient { + + /** * A port exposed by a container. */ @@ -15983,22 +14847,6 @@ export class Client extends BaseClient { return new Container(ctx) } - /** - * Returns the current environment - * - * When called from a function invoked via an LLM tool call, this will be the LLM's current environment, including any modifications made through calling tools. Env values returned by functions become the new environment for subsequent calls, and Changeset values returned by functions are applied to the environment's workspace. - * - * When called from a module function outside of an LLM, this returns an Env with the current module installed, and with the current module's source directory as its workspace. - * @experimental - */ - currentEnv = (): Env => { - - const ctx = this._ctx.select( - "currentEnv", - ) - return new Env(ctx) - } - /** * The FunctionCall context that the SDK caller is currently executing in. * @@ -16023,6 +14871,17 @@ export class Client extends BaseClient { return new CurrentModule(ctx) } + /** + * The object that received the current module function call, as a Node. Errors when there is no current call, or the call is top-level (e.g. a module constructor). + */ + currentNode = (): Node => { + + const ctx = this._ctx.select( + "currentNode", + ) + return new _NodeClient(ctx) + } + /** * The TypeDef representations of the objects currently being served in the session. * @param opts.returnAllTypes Return the full referenced typedef closure instead of only top-level served typedefs. @@ -16096,18 +14955,17 @@ export class Client extends BaseClient { } /** - * Initializes a new environment - * @param opts.privileged Give the environment the same privileges as the caller: core API including host access, current module, and dependencies - * @param opts.writable Allow new outputs to be declared and saved in the environment - * @experimental + * Constructs an engine-managed volume backed by operator-provided storage beneath the configured engine state root. + * @param name Canonical slash-separated volume name beneath the engine volume namespace. + * @param opts.subdir Optional existing subdirectory within the volume payload to mount. */ - env = (opts?: ClientEnvOpts): Env => { + engineVolume = (name: string, opts?: ClientEngineVolumeOpts): Volume => { const ctx = this._ctx.select( - "env", - { ...opts }, + "engineVolume", + { name, ...opts }, ) - return new Env(ctx) + return new Volume(ctx) } /** @@ -16291,13 +15149,18 @@ export class Client extends BaseClient { /** * Load any object by its ID. */ - node = (id: ID): Node => { - + node = async (id: ID): Promise => { const ctx = this._ctx.select( "node", - { id }, - ) - return new _NodeClient(ctx) + { id}, + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new _NodeClient(ctx.copy().selectNode(response, "Node")) } /** @@ -17717,67 +16580,97 @@ export class TypeDef extends BaseClient { /** * If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null. */ - asEnum = (): EnumTypeDef => { - + asEnum = async (): Promise => { const ctx = this._ctx.select( "asEnum", - ) - return new EnumTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new EnumTypeDef(ctx.copy().selectNode(response, "EnumTypeDef")) } /** * If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null. */ - asInput = (): InputTypeDef => { - + asInput = async (): Promise => { const ctx = this._ctx.select( "asInput", - ) - return new InputTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new InputTypeDef(ctx.copy().selectNode(response, "InputTypeDef")) } /** * If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null. */ - asInterface = (): InterfaceTypeDef => { - + asInterface = async (): Promise => { const ctx = this._ctx.select( "asInterface", - ) - return new InterfaceTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new InterfaceTypeDef(ctx.copy().selectNode(response, "InterfaceTypeDef")) } /** * If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null. */ - asList = (): ListTypeDef => { - + asList = async (): Promise => { const ctx = this._ctx.select( "asList", - ) - return new ListTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new ListTypeDef(ctx.copy().selectNode(response, "ListTypeDef")) } /** * If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null. */ - asObject = (): ObjectTypeDef => { - + asObject = async (): Promise => { const ctx = this._ctx.select( "asObject", - ) - return new ObjectTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new ObjectTypeDef(ctx.copy().selectNode(response, "ObjectTypeDef")) } /** * If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null. */ - asScalar = (): ScalarTypeDef => { - + asScalar = async (): Promise => { const ctx = this._ctx.select( "asScalar", - ) - return new ScalarTypeDef(ctx) + ).select("id") + + const response: Awaited = await ctx.execute() + + if (response === null) { + return null + } + return new ScalarTypeDef(ctx.copy().selectNode(response, "ScalarTypeDef")) } /** @@ -18324,12 +17217,29 @@ export class Workspace extends BaseClient { } /** - * Return this workspace's pending overlay changes. + * Return all agent middlewares from modules loaded in the workspace. + * @param opts.include Only include agents matching the specified patterns */ - changes = (): Changeset => { + agents = (opts?: WorkspaceAgentsOpts): AgentGroup => { + + const ctx = this._ctx.select( + "agents", + { ...opts }, + ) + return new AgentGroup(ctx) + } + + /** + * Return this workspace's changes, with paths relative to its working directory. + * + * Pass from to compare against an earlier workspace state. Omitting it preserves the cumulative behavior used by clients from before this argument was added. + * @param opts.from An earlier workspace state to compare against. + */ + changes = (opts?: WorkspaceChangesOpts): Changeset => { const ctx = this._ctx.select( "changes", + { ...opts }, ) return new Changeset(ctx) } @@ -18481,6 +17391,29 @@ export class Workspace extends BaseClient { return new File(ctx) } + /** + * Find project roots marked by any of the given filenames, starting from a path relative to the workspace cwd. + * + * Returns cwd-relative directory paths for every marked directory at or below start, plus the nearest marked ancestor when start itself is not marked. + * + * Each returned path is usable as-is with other workspace APIs, e.g. directory(path). + * @param opts.start Directory to start from. Relative paths resolve from the workspace cwd. + * @param opts.markers File basenames that mark a project root (e.g. ["go.mod"] or ["deno.json", "deno.jsonc"]). + * @param opts.exclude Glob patterns pruning the walk below start (e.g. ["**\/node_modules/**"]). + */ + findRoots = async ( + opts?: WorkspaceFindRootsOpts): Promise => { + const ctx = this._ctx.select( + "findRoots", + { ...opts}, + ) + + const response: Awaited = await ctx.execute() + + + return response + } + /** * Search for a file or directory by walking up from the start path within the workspace. * @@ -18566,6 +17499,8 @@ export class Workspace extends BaseClient { /** * Return a module defined in the workspace configuration. + * + * Reflects the selected env's effective view. * @param name Module name to inspect. */ module_ = (name: string): WorkspaceModule => { @@ -18596,6 +17531,8 @@ export class Workspace extends BaseClient { /** * List modules defined in the workspace configuration. + * + * Reflects the selected env's effective view. */ modules = async (): Promise => { type modules = { @@ -18612,6 +17549,17 @@ export class Workspace extends BaseClient { return response.map((r) => new WorkspaceModule(ctx.copy().selectNode(r.id, "WorkspaceModule"))) } + /** + * Return this workspace with its cached host reads invalidated, so subsequent file and directory reads re-read the live host instead of a snapshot cached earlier in the session. + */ + reloaded = (): Workspace => { + + const ctx = this._ctx.select( + "reloaded", + ) + return new Workspace(ctx) + } + /** * An installed SDK, by name. * @param name SDK name to look up. @@ -18720,6 +17668,8 @@ export class Workspace extends BaseClient { /** * Return this workspace with a configuration value written. + * + * When the session selects an env, the key is scoped to that env's overlay and the env is created if missing. * @param key Dotted key path. * @param value Value to set. Bools, integers, and comma-separated arrays are auto-detected. * @param opts.values List value to set. Elements are stored verbatim, with no auto-detection. Mutually exclusive with value. @@ -18736,11 +17686,14 @@ export class Workspace extends BaseClient { /** * Return this workspace with a generated API client initialized. - * @param path Workspace-relative output directory for the generated client. + * + * The SDK's generators run for the new client, so the returned workspace carries its generated bindings. + * @param path Output directory for the generated client, relative to the workspace cwd; a leading "/" is relative to the workspace root. * @param sdk Workspace SDK name or module entry name to use. * @param module Workspace-relative path or canonical ref for the module the client binds to. * @param opts.args SDK-specific init arguments. * @param opts.here Write to the workspace config directory at the workspace cwd. + * @param opts.noGenerate Skip running the SDK's generators for the new client. */ withInitClient = (path: string, sdk: string, module_: string, opts?: WorkspaceWithInitClientOpts): Workspace => { @@ -18754,13 +17707,16 @@ export class Workspace extends BaseClient { /** * Return this workspace with a new module initialized. + * + * The SDK's generators run for the new module, so the returned workspace carries the generated code it needs to be loadable. * @param name Name of the new module. * @param sdk Workspace SDK name or module entry name to use. - * @param opts.path Workspace-relative path for the new module. + * @param opts.path Path for the new module, relative to the workspace cwd; a leading "/" is relative to the workspace root. Defaults to .dagger/modules/ beside the workspace config. * @param opts.source Source subpath within the new module. * @param opts.include Additional include patterns for the module. * @param opts.args SDK-specific init arguments. * @param opts.here Write to the workspace config directory at the workspace cwd. + * @param opts.noGenerate Skip running the SDK's generators for the new module. */ withInitModule = (name: string, sdk: string, opts?: WorkspaceWithInitModuleOpts): Workspace => { @@ -18773,6 +17729,8 @@ export class Workspace extends BaseClient { /** * Return this workspace with a module installed in its config. + * + * When the session selects an env, the module is recorded in that env's overlay and the env is created if missing. * @param ref Module reference to install. * @param opts.name Override name for the installed module entry. * @param opts.here Write to the workspace config directory at the workspace cwd. @@ -18786,6 +17744,38 @@ export class Workspace extends BaseClient { return new Workspace(ctx) } + /** + * Return this workspace with a directory mounted read-only at the given path, without mutating the source. + * + * Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified. + * @param path Location of the mounted directory. Relative paths resolve from the workspace cwd. + * @param source Directory to mount. + */ + withMountedDirectory = (path: string, source: Directory): Workspace => { + + const ctx = this._ctx.select( + "withMountedDirectory", + { path, source }, + ) + return new Workspace(ctx) + } + + /** + * Return this workspace with a file mounted read-only at the given path, without mutating the source. + * + * Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified. + * @param path Location of the mounted file. Relative paths resolve from the workspace cwd. + * @param source File to mount. + */ + withMountedFile = (path: string, source: File): Workspace => { + + const ctx = this._ctx.select( + "withMountedFile", + { path, source }, + ) + return new Workspace(ctx) + } + /** * Return this workspace with a directory added, without mutating the source. * @param path Path of the added directory. Relative paths resolve from the workspace cwd. @@ -18873,6 +17863,8 @@ export class Workspace extends BaseClient { * Return this workspace with a configuration value removed. * * Errors when the key is not currently set. + * + * When the session selects an env, the key is scoped to that env's overlay. * @param key Dotted key path (e.g. modules.greeter.settings.greeting). * @param opts.here Write to the workspace config directory at the workspace cwd. */ @@ -18885,8 +17877,36 @@ export class Workspace extends BaseClient { return new Workspace(ctx) } + /** + * Return this workspace with a directory removed, without mutating the source. + * @param path Path of the directory to remove. Relative paths resolve from the workspace cwd. + */ + withoutDirectory = (path: string): Workspace => { + + const ctx = this._ctx.select( + "withoutDirectory", + { path }, + ) + return new Workspace(ctx) + } + + /** + * Return this workspace with a file removed, without mutating the source. + * @param path Path of the file to remove. Relative paths resolve from the workspace cwd. + */ + withoutFile = (path: string): Workspace => { + + const ctx = this._ctx.select( + "withoutFile", + { path }, + ) + return new Workspace(ctx) + } + /** * Return this workspace with a module removed from its config. + * + * When the session selects an env, only that env's overlay entry is removed. * @param name Name of the installed module entry to remove. * @param opts.here Write to the workspace config directory at the workspace cwd. */ diff --git a/library/src/module/decorators.ts b/library/src/module/decorators.ts index 2987bb6..99252d9 100644 --- a/library/src/module/decorators.ts +++ b/library/src/module/decorators.ts @@ -36,6 +36,16 @@ export const generate = registry.generate */ export const up = registry.up +/** + * The definition of @agent decorator that marks a function as an agent + * middleware: it takes a base LLM and returns an LLM with the module's tools + * and prompting folded onto it. `dagger agent` discovers and composes these. + * + * Besides the base LLM, an agent function may not declare any other required + * argument. + */ +export const agent = registry.agent + /** * The definition of @field decorator that should be on top of any * class' property that must be exposed to the Dagger API. diff --git a/library/src/module/entrypoint/register.ts b/library/src/module/entrypoint/register.ts index 0575528..e69942c 100644 --- a/library/src/module/entrypoint/register.ts +++ b/library/src/module/entrypoint/register.ts @@ -176,6 +176,10 @@ export class Register { fnDef = fnDef.withUp() } + if ((fct as Method).isAgent) { + fnDef = fnDef.withAgent() + } + return fnDef } diff --git a/library/src/module/introspector/dagger_module/decorator.ts b/library/src/module/introspector/dagger_module/decorator.ts index 79e2d97..54496f7 100644 --- a/library/src/module/introspector/dagger_module/decorator.ts +++ b/library/src/module/introspector/dagger_module/decorator.ts @@ -7,6 +7,7 @@ import { check, generate, up, + agent, } from "../../decorators.js" export type DaggerDecorators = @@ -15,6 +16,7 @@ export type DaggerDecorators = | "check" | "generate" | "up" + | "agent" | "argument" | "enumType" | "field" @@ -24,6 +26,7 @@ export const FUNCTION_DECORATOR = func.name as DaggerDecorators export const CHECK_DECORATOR = check.name as DaggerDecorators export const GENERATOR_DECORATOR = generate.name as DaggerDecorators export const UP_DECORATOR = up.name as DaggerDecorators +export const AGENT_DECORATOR = agent.name as DaggerDecorators export const FIELD_DECORATOR = field.name as DaggerDecorators export const ARGUMENT_DECORATOR = argument.name as DaggerDecorators export const ENUM_DECORATOR = enumType.name as DaggerDecorators diff --git a/library/src/module/introspector/dagger_module/function.ts b/library/src/module/introspector/dagger_module/function.ts index 1d7d881..b77f36b 100644 --- a/library/src/module/introspector/dagger_module/function.ts +++ b/library/src/module/introspector/dagger_module/function.ts @@ -11,6 +11,7 @@ import { } from "../typescript_module/index.js" import { DaggerArgument, DaggerArguments } from "./argument.js" import { + AGENT_DECORATOR, CHECK_DECORATOR, FUNCTION_DECORATOR, GENERATOR_DECORATOR, @@ -33,6 +34,7 @@ export class DaggerFunction extends Locatable { public isCheck: boolean = false public isGenerator: boolean = false public isUp: boolean = false + public isAgent: boolean = false private signature: ts.Signature private symbol: ts.Symbol @@ -79,6 +81,11 @@ export class DaggerFunction extends Locatable { this.isUp = true } + // Parse @agent decorator + if (this.ast.isNodeDecoratedWith(this.node, AGENT_DECORATOR)) { + this.isAgent = true + } + for (const parameter of this.node.parameters) { this.arguments[parameter.name.getText()] = new DaggerArgument( parameter, diff --git a/library/src/module/introspector/test/testdata/decorators/expected.json b/library/src/module/introspector/test/testdata/decorators/expected.json index 16dfc87..9b0e5e1 100644 --- a/library/src/module/introspector/test/testdata/decorators/expected.json +++ b/library/src/module/introspector/test/testdata/decorators/expected.json @@ -263,6 +263,27 @@ "kind": "OBJECT_KIND", "name": "Service" } + }, + "agentSomething": { + "name": "agentSomething", + "description": "", + "arguments": { + "base": { + "name": "base", + "description": "", + "type": { + "kind": "OBJECT_KIND", + "name": "LLM" + }, + "isVariadic": false, + "isNullable": false, + "isOptional": false + } + }, + "returnType": { + "kind": "OBJECT_KIND", + "name": "LLM" + } } }, "properties": { diff --git a/library/src/module/introspector/test/testdata/decorators/index.ts b/library/src/module/introspector/test/testdata/decorators/index.ts index 1e6a713..2e7378b 100644 --- a/library/src/module/introspector/test/testdata/decorators/index.ts +++ b/library/src/module/introspector/test/testdata/decorators/index.ts @@ -3,9 +3,11 @@ import { Container, Directory, File, + LLM, Service, } from "../../../../../api/client.gen.js" import { + agent, argument, check, field, @@ -138,7 +140,7 @@ export class Decorators { return "cached" } - // --- @check / @generate / @up markers (combined with @func) --- + // --- @check / @generate / @up / @agent markers (combined with @func) --- @func() @check() @@ -155,4 +157,10 @@ export class Decorators { upSomething(): Service { throw new Error("not implemented") } + + @func() + @agent() + agentSomething(base: LLM): LLM { + return base + } } diff --git a/library/src/module/introspector/typedef_json.ts b/library/src/module/introspector/typedef_json.ts index fb20f42..8eca05a 100644 --- a/library/src/module/introspector/typedef_json.ts +++ b/library/src/module/introspector/typedef_json.ts @@ -72,6 +72,7 @@ function serializeFunction(fn: DaggerFunction | DaggerInterfaceFunction) { isCheck: f.isCheck === true, isGenerator: f.isGenerator === true, isUp: f.isUp === true, + isAgent: f.isAgent === true, location: f.getLocation(), returnType: f.returnType ? serializeType(f.returnType) : undefined, arguments: Object.values(f.arguments).map(serializeArgument), diff --git a/library/src/module/registry.ts b/library/src/module/registry.ts index 95a6f46..e13a5ac 100644 --- a/library/src/module/registry.ts +++ b/library/src/module/registry.ts @@ -175,6 +175,22 @@ export class Registry { return (target, propertyKey, descriptor) => descriptor } + /** + * The definition of @agent decorator that marks a function as an agent + * middleware, composed by `dagger agent`. + */ + agent = (): (( + target: object, + propertyKey: string | symbol, + descriptor?: PropertyDescriptor, + ) => void) => { + return ( + target: object, + propertyKey: string | symbol, + descriptor?: PropertyDescriptor, + ) => {} + } + argument = ( opts?: ArgumentOptions, ): (( diff --git a/library/src/provisioning/default.ts b/library/src/provisioning/default.ts index 0d245a9..4b7d5aa 100644 --- a/library/src/provisioning/default.ts +++ b/library/src/provisioning/default.ts @@ -1,2 +1,2 @@ // Code generated by dagger. DO NOT EDIT. -export const CLI_VERSION = "1.0.0-beta.9" +export const CLI_VERSION = "1.0.0-beta.10" diff --git a/library/yarn.lock b/library/yarn.lock index 5a1e24d..f322ea0 100644 --- a/library/yarn.lock +++ b/library/yarn.lock @@ -486,6 +486,13 @@ dependencies: "@opentelemetry/semantic-conventions" "^1.29.0" +"@opentelemetry/core@2.9.0": + version "2.9.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-2.9.0.tgz#49de86106f86255b471b2ff035ef1003a851b252" + integrity sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw== + dependencies: + "@opentelemetry/semantic-conventions" "^1.29.0" + "@opentelemetry/exporter-jaeger@^2.8.0": version "2.8.0" resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-jaeger/-/exporter-jaeger-2.8.0.tgz#9ea71246710570fc3375d235a04d39c3227e9103" @@ -844,19 +851,12 @@ dependencies: "@opentelemetry/core" "2.8.0" -"@opentelemetry/propagator-jaeger@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-jaeger/-/propagator-jaeger-2.3.0.tgz#4056de2c3a3fc8a39122a196188a407730e15e2b" - integrity sha512-1SPtVuU5wF9NSrkpdu78B2Nta+Vi7xjRRZ2OGhmV1Ju8TSsTL4LCrty9uBxPdkGI4J/HISwRsaMt8GdM4P3HqA== - dependencies: - "@opentelemetry/core" "2.3.0" - -"@opentelemetry/propagator-jaeger@2.8.0": - version "2.8.0" - resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-jaeger/-/propagator-jaeger-2.8.0.tgz#b8866476fd4a3953dd660a6ab5dc8e2b618dd9e8" - integrity sha512-Xnz9zZvvQzUw+9DrOn0MomR7BxFCkA2pcfXBQuHC28ndJpSbjLs7knzYb05kw5SyCjSsEWombkZMgGcJSk8JVg== +"@opentelemetry/propagator-jaeger@2.3.0", "@opentelemetry/propagator-jaeger@2.8.0", "@opentelemetry/propagator-jaeger@2.9.0": + version "2.9.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-jaeger/-/propagator-jaeger-2.9.0.tgz#7fbb5943782aa8cb83d5c41c316cd8be00438747" + integrity sha512-4mYGty27rYvSM0jtp1ZUOqd3LfVRCYg9H5G9OFzSx5HViYToU21MFhWfco7x1HwXr7ER8yGOiCIHZUwjPksc0Q== dependencies: - "@opentelemetry/core" "2.8.0" + "@opentelemetry/core" "2.9.0" "@opentelemetry/resources@2.3.0": version "2.3.0" @@ -1415,10 +1415,10 @@ acorn@^8.16.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.16.0.tgz#4ce79c89be40afe7afe8f3adb902a1f1ce9ac08a" integrity sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw== -adm-zip@^0.5.18: - version "0.5.18" - resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.18.tgz#283a05f2bf1e3fd315f0f31cde29b7a6e3c1619d" - integrity sha512-ufJnssQGbxzLNS1Ho9bCtX4rQKCCvoVuDLHoJyc3F9dOGDB4BkWs2Ci0kv53lqocAEQ/Cbi+I2XCsNYGqVYqng== +adm-zip@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.6.0.tgz#bbc5c6c333755e967a06dd98747f431e1d53a3cf" + integrity sha512-XleryMhbuksdKtofnWZ9Sk+4CUTbms4Mb/EU32SZwToAyZ5RgVos/ki8n+yr0LWHOGKuakbXTuuYNHLQjhddgg== ajv@^6.14.0: version "6.14.0" @@ -1483,16 +1483,16 @@ balanced-match@^4.0.2: integrity sha512-1pHv8LX9CpKut1Zp4EXey7Z8OfH11ONNH6Dhi2WDUt31VVZFXZzKwXcysBgqSumFCmR+0dqjMK5v5JiFHzi0+g== brace-expansion@^2.0.2: - version "2.1.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.1.tgz#c68b1c4111c76aae3a6fba55d496cee10c39dad8" - integrity sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA== + version "2.1.4" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.4.tgz#589dab11c0018d0366be64cd8bf12c8dbecc8326" + integrity sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg== dependencies: balanced-match "^1.0.0" brace-expansion@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.2.tgz#b6c16d0791087af6c2bc463f52a8142046c06b6f" - integrity sha512-Pdk8c9poy+YhOgVWw1JNN22/HcivgKWwpxKq04M/jTmHyCZn12WPJebZxdjSa5TmBqISrUSgNYU3eRORljfCCw== + version "5.0.9" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.9.tgz#7c72438809b5fa5babf54199a1f1c281a6984fcf" + integrity sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg== dependencies: balanced-match "^4.0.2" @@ -2224,9 +2224,9 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + version "4.3.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.1.tgz#01216c001d67f48e2cd560d708c7af21090a3848" + integrity sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ== dependencies: argparse "^2.0.1" From 9b4207bd25673cda52745b14a9120ee3893d4e1d Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Thu, 20 Aug 2026 15:53:28 +0200 Subject: [PATCH 2/3] chore: pick up sdk-sdk's contract-check CLI fix dagger/sdk-sdk#20 threads the configured CLI release through to the contract checks, which previously ran mod-test's own pinned default and so paired this SDK's beta.10 bundle with a beta.9 engine. All 22 contract-suite checks pass again. The workspace pin stays: sdk-sdk's default matches ours today, but this SDK ships a library built for one engine release, so the version the harness runs is load-bearing. Pinning states that, rather than inheriting whatever sdk-sdk moves to next. Signed-off-by: Tom Chauveau --- dagger.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dagger.toml b/dagger.toml index c2364f0..6516936 100644 --- a/dagger.toml +++ b/dagger.toml @@ -21,9 +21,11 @@ check.skip = ["*"] [modules.sdk-sdk] source = "github.com/dagger/sdk-sdk" -# The contract suite drives a real CLI through the whole user path. It pins its -# own release, which has to match the engine this SDK's committed bundle is -# built for — otherwise the checks pair our library with an older engine. +# The contract suite drives a real CLI through the whole user path, so the +# release it runs has to match the engine this SDK's committed bundle is built +# for. sdk-sdk's own default tracks the same version today; pinning it here +# states the requirement, so its default moving ahead of ours shows up as a +# failing check rather than a library quietly paired with a newer engine. settings.daggerCliVersion = "1.0.0-beta.10" [modules.typescript-sdk.as-sdk] From e8eab51c644905e443de37eb3f38d65106b60352 Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Thu, 20 Aug 2026 16:09:08 +0200 Subject: [PATCH 3/3] docs: record what fork.withDirectory actually does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The client-bundle design leaned on withDirectory being an overlay, which it is not: the polyfill documents it as "add or replace" and the replace is real in the changeset's after tree. What makes client regeneration safe is that a client changeset is only ever applied to disk, and applying is additive. That distinction is the difference between the two paths. Module generation stages its changeset into a workspace and reads it back, where unstaged files — the module's own config and source — do disappear; hence the diff-based staging it uses instead. Verified rather than reasoned: a client directory holding a vendored sdk/core.js and an unrelated NOTES.md keeps both across a regeneration, with removedPaths empty. Signed-off-by: Tom Chauveau --- design/client-bundle.md | 15 +++++++++++---- design/module-gen.md | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/design/client-bundle.md b/design/client-bundle.md index 3dc6102..9dfd040 100644 --- a/design/client-bundle.md +++ b/design/client-bundle.md @@ -67,10 +67,17 @@ upstream's `Local` SDK-lib origin (`detectSDKLibOrigin`: `"@dagger.io/dagger" == "deno.json"])`, mounted at `/existing`. (Guard for a not-yet-existing client dir → fall back to empty.) - The vendored `sdk/` directory itself survives regeneration for free: the fork - stages the client via `withDirectory(client.path, generated)`, which is an - **overlay** — files the user has under `/sdk/` that codegen - doesn't emit are preserved. + The vendored `sdk/` directory itself survives regeneration for free — though + not because `withDirectory` is an overlay, as this originally claimed. The + polyfill documents it as "add or replace", and the replace is real in the + changeset's *after* tree. What makes this safe is that a client changeset is + only ever applied to disk, and applying is additive. Confirmed by + regenerating a client directory holding a vendored `sdk/core.js` and an + unrelated `NOTES.md`: both survive, and `removedPaths` comes back empty. + + The distinction matters if this is reused elsewhere. Module generation stages + its changeset into a workspace and reads it back, where the replace *does* + drop unstaged files — see `module-gen.md`. That's it. No new engine primitive, no bundle shipped by this repo, no new generator modes. diff --git a/design/module-gen.md b/design/module-gen.md index f295078..6fcfbe0 100644 --- a/design/module-gen.md +++ b/design/module-gen.md @@ -582,6 +582,21 @@ staleness check, with a better message than a hand-written one: with the committed bindings and watching it fail. An engine bump therefore shows up as a failing check rather than silent drift. +**On `fork.withDirectory` (worth knowing before reusing it).** The polyfill +documents it as "add or replace", and the replace is real: whatever is not +staged is absent from the changeset's *after* tree. That only shows up when a +changeset is staged into a workspace and read back — `ws.withChanges`, which is +how the engine generates a local dependency — where it silently drops the +module's own config and source. Applying to disk is additive, so the same +changeset looks fine there. + +Module generation therefore stages a diff over the module's existing tree +(§7 Phase 3). Client generation does not need to: a client changeset is only +ever applied, never staged and re-read. Verified rather than assumed — a client +directory carrying a vendored `sdk/` and an unrelated file keeps both across a +regeneration, and the changeset's `removedPaths` is empty, so the preservation +`client-bundle.md` relies on holds. + **VCS files are not written** (decided): no `.gitignore`, no `.gitattributes`. The engine appends to both around codegen, but for a workspace module the ignore list is reduced to `node_modules`/`.pnpm-store` anyway, which is the