@dagger.io/dagger 0.18.19 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,34 +131,6 @@ export type ContainerAsTarballOpts = {
131
131
  */
132
132
  mediaTypes?: ImageMediaTypes;
133
133
  };
134
- export type ContainerBuildOpts = {
135
- /**
136
- * Path to the Dockerfile to use.
137
- */
138
- dockerfile?: string;
139
- /**
140
- * Target build stage to build.
141
- */
142
- target?: string;
143
- /**
144
- * Additional build arguments.
145
- */
146
- buildArgs?: BuildArg[];
147
- /**
148
- * Secrets to pass to the build.
149
- *
150
- * They will be mounted at /run/secrets/[secret-name] in the build container
151
- *
152
- * They can be accessed in the Dockerfile using the "secret" mount type and mount path /run/secrets/[secret-name], e.g. RUN --mount=type=secret,id=my-secret curl [http://example.com?token=$(cat /run/secrets/my-secret)](http://example.com?token=$(cat /run/secrets/my-secret))
153
- */
154
- secrets?: Secret[];
155
- /**
156
- * If set, skip the automatic init process injected into containers created by RUN statements.
157
- *
158
- * 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.
159
- */
160
- noInit?: boolean;
161
- };
162
134
  export type ContainerDirectoryOpts = {
163
135
  /**
164
136
  * Replace "${VAR}" or "$VAR" in the value of path according to the current environment variables defined in the container (e.g. "/$VAR/foo").
@@ -878,6 +850,18 @@ export type EnumTypeDefID = string & {
878
850
  export type EnumValueTypeDefID = string & {
879
851
  __EnumValueTypeDefID: never;
880
852
  };
853
+ export type EnvFileGetOpts = {
854
+ /**
855
+ * Return the value exactly as written to the file. No quote removal or variable expansion
856
+ */
857
+ raw?: boolean;
858
+ };
859
+ export type EnvFileVariablesOpts = {
860
+ /**
861
+ * Return values exactly as written to the file. No quote removal or variable expansion
862
+ */
863
+ raw?: boolean;
864
+ };
881
865
  /**
882
866
  * The `EnvFileID` scalar type represents an identifier for an object of type EnvFile.
883
867
  */
@@ -1844,10 +1828,6 @@ export declare class Binding extends BaseClient {
1844
1828
  * Retrieve the binding value, as type JSONValue
1845
1829
  */
1846
1830
  asJSONValue: () => JSONValue;
1847
- /**
1848
- * Retrieve the binding value, as type LLM
1849
- */
1850
- asLLM: () => LLM;
1851
1831
  /**
1852
1832
  * Retrieve the binding value, as type Module
1853
1833
  */
@@ -1881,11 +1861,11 @@ export declare class Binding extends BaseClient {
1881
1861
  */
1882
1862
  asSocket: () => Socket;
1883
1863
  /**
1884
- * The binding's string value
1864
+ * Returns the binding's string value
1885
1865
  */
1886
1866
  asString: () => Promise<string>;
1887
1867
  /**
1888
- * The digest of the binding value
1868
+ * Returns the digest of the binding value
1889
1869
  */
1890
1870
  digest: () => Promise<string>;
1891
1871
  /**
@@ -1893,11 +1873,11 @@ export declare class Binding extends BaseClient {
1893
1873
  */
1894
1874
  isNull: () => Promise<boolean>;
1895
1875
  /**
1896
- * The binding name
1876
+ * Returns the binding name
1897
1877
  */
1898
1878
  name: () => Promise<string>;
1899
1879
  /**
1900
- * The binding type
1880
+ * Returns the binding type
1901
1881
  */
1902
1882
  typeName: () => Promise<string>;
1903
1883
  }
@@ -2045,23 +2025,6 @@ export declare class Container extends BaseClient {
2045
2025
  * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
2046
2026
  */
2047
2027
  asTarball: (opts?: ContainerAsTarballOpts) => File;
2048
- /**
2049
- * Initializes this container from a Dockerfile build.
2050
- * @param context Directory context used by the Dockerfile.
2051
- * @param opts.dockerfile Path to the Dockerfile to use.
2052
- * @param opts.target Target build stage to build.
2053
- * @param opts.buildArgs Additional build arguments.
2054
- * @param opts.secrets Secrets to pass to the build.
2055
- *
2056
- * They will be mounted at /run/secrets/[secret-name] in the build container
2057
- *
2058
- * They can be accessed in the Dockerfile using the "secret" mount type and mount path /run/secrets/[secret-name], e.g. RUN --mount=type=secret,id=my-secret curl [http://example.com?token=$(cat /run/secrets/my-secret)](http://example.com?token=$(cat /run/secrets/my-secret))
2059
- * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements.
2060
- *
2061
- * 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.
2062
- * @deprecated Use `Directory.build` instead
2063
- */
2064
- build: (context: Directory, opts?: ContainerBuildOpts) => Container;
2065
2028
  /**
2066
2029
  * The combined buffered standard output and standard error stream of the last executed command
2067
2030
  *
@@ -2294,7 +2257,7 @@ export declare class Container extends BaseClient {
2294
2257
  /**
2295
2258
  * Return a new container snapshot, with a directory added to its filesystem
2296
2259
  * @param path Location of the written directory (e.g., "/tmp/directory").
2297
- * @param directory Identifier of the directory to write
2260
+ * @param source Identifier of the directory to write
2298
2261
  * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
2299
2262
  * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]).
2300
2263
  * @param opts.owner A user:group to set for the directory and its contents.
@@ -2304,7 +2267,7 @@ export declare class Container extends BaseClient {
2304
2267
  * If the group is omitted, it defaults to the same as the user.
2305
2268
  * @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").
2306
2269
  */
2307
- withDirectory: (path: string, directory: Directory, opts?: ContainerWithDirectoryOpts) => Container;
2270
+ withDirectory: (path: string, source: Directory, opts?: ContainerWithDirectoryOpts) => Container;
2308
2271
  /**
2309
2272
  * Set an OCI-style entrypoint. It will be included in the container's OCI configuration. Note, withExec ignores the entrypoint by default.
2310
2273
  * @param args Arguments of the entrypoint. Example: ["go", "run"].
@@ -2815,7 +2778,7 @@ export declare class Directory extends BaseClient {
2815
2778
  /**
2816
2779
  * Return a snapshot with a directory added
2817
2780
  * @param path Location of the written directory (e.g., "/src/").
2818
- * @param directory Identifier of the directory to copy.
2781
+ * @param source Identifier of the directory to copy.
2819
2782
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
2820
2783
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
2821
2784
  * @param opts.owner A user:group to set for the copied directory and its contents.
@@ -2824,7 +2787,7 @@ export declare class Directory extends BaseClient {
2824
2787
  *
2825
2788
  * If the group is omitted, it defaults to the same as the user.
2826
2789
  */
2827
- withDirectory: (path: string, directory: Directory, opts?: DirectoryWithDirectoryOpts) => Directory;
2790
+ withDirectory: (path: string, source: Directory, opts?: DirectoryWithDirectoryOpts) => Directory;
2828
2791
  /**
2829
2792
  * Retrieves this directory plus the contents of the given file copied to the given path.
2830
2793
  * @param path Location of the copied file (e.g., "/file.txt").
@@ -2927,7 +2890,6 @@ export declare class Engine extends BaseClient {
2927
2890
  */
2928
2891
  export declare class EngineCache extends BaseClient {
2929
2892
  private readonly _id?;
2930
- private readonly _keepBytes?;
2931
2893
  private readonly _maxUsedSpace?;
2932
2894
  private readonly _minFreeSpace?;
2933
2895
  private readonly _prune?;
@@ -2936,7 +2898,7 @@ export declare class EngineCache extends BaseClient {
2936
2898
  /**
2937
2899
  * Constructor is used for internal usage only, do not create object from it.
2938
2900
  */
2939
- constructor(ctx?: Context, _id?: EngineCacheID, _keepBytes?: number, _maxUsedSpace?: number, _minFreeSpace?: number, _prune?: Void, _reservedSpace?: number, _targetSpace?: number);
2901
+ constructor(ctx?: Context, _id?: EngineCacheID, _maxUsedSpace?: number, _minFreeSpace?: number, _prune?: Void, _reservedSpace?: number, _targetSpace?: number);
2940
2902
  /**
2941
2903
  * A unique identifier for this EngineCache.
2942
2904
  */
@@ -2945,11 +2907,6 @@ export declare class EngineCache extends BaseClient {
2945
2907
  * The current set of entries in the cache
2946
2908
  */
2947
2909
  entrySet: (opts?: EngineCacheEntrySetOpts) => EngineCacheEntrySet;
2948
- /**
2949
- * The maximum bytes to keep in the cache without pruning, after which automatic pruning may kick in.
2950
- * @deprecated Use minFreeSpace instead.
2951
- */
2952
- keepBytes: () => Promise<number>;
2953
2910
  /**
2954
2911
  * The maximum bytes to keep in the cache without pruning.
2955
2912
  */
@@ -3124,19 +3081,19 @@ export declare class Env extends BaseClient {
3124
3081
  */
3125
3082
  id: () => Promise<EnvID>;
3126
3083
  /**
3127
- * retrieve an input value by name
3084
+ * Retrieves an input binding by name
3128
3085
  */
3129
3086
  input: (name: string) => Binding;
3130
3087
  /**
3131
- * return all input values for the environment
3088
+ * Returns all input bindings provided to the environment
3132
3089
  */
3133
3090
  inputs: () => Promise<Binding[]>;
3134
3091
  /**
3135
- * retrieve an output value by name
3092
+ * Retrieves an output binding by name
3136
3093
  */
3137
3094
  output: (name: string) => Binding;
3138
3095
  /**
3139
- * return all output values for the environment
3096
+ * Returns all declared output bindings for the environment
3140
3097
  */
3141
3098
  outputs: () => Promise<Binding[]>;
3142
3099
  /**
@@ -3204,6 +3161,12 @@ export declare class Env extends BaseClient {
3204
3161
  * @param description A description of the desired value of the binding
3205
3162
  */
3206
3163
  withContainerOutput: (name: string, description: string) => Env;
3164
+ /**
3165
+ * Installs the current module into the environment, exposing its functions to the model
3166
+ *
3167
+ * Contextual path arguments will be populated using the environment's workspace.
3168
+ */
3169
+ withCurrentModule: () => Env;
3207
3170
  /**
3208
3171
  * Create or update a binding of type Directory in the environment
3209
3172
  * @param name The name of the binding
@@ -3296,18 +3259,11 @@ export declare class Env extends BaseClient {
3296
3259
  */
3297
3260
  withJSONValueOutput: (name: string, description: string) => Env;
3298
3261
  /**
3299
- * Create or update a binding of type LLM in the environment
3300
- * @param name The name of the binding
3301
- * @param value The LLM value to assign to the binding
3302
- * @param description The purpose of the input
3303
- */
3304
- withLLMInput: (name: string, value: LLM, description: string) => Env;
3305
- /**
3306
- * Declare a desired LLM output to be assigned in the environment
3307
- * @param name The name of the binding
3308
- * @param description A description of the desired value of the binding
3262
+ * Installs a module into the environment, exposing its functions to the model
3263
+ *
3264
+ * Contextual path arguments will be populated using the environment's workspace.
3309
3265
  */
3310
- withLLMOutput: (name: string, description: string) => Env;
3266
+ withModule: (module_: Module_) => Env;
3311
3267
  /**
3312
3268
  * Create or update a binding of type ModuleConfigClient in the environment
3313
3269
  * @param name The name of the binding
@@ -3413,18 +3369,28 @@ export declare class Env extends BaseClient {
3413
3369
  */
3414
3370
  withSocketOutput: (name: string, description: string) => Env;
3415
3371
  /**
3416
- * Create or update an input value of type string
3372
+ * Provides a string input binding to the environment
3417
3373
  * @param name The name of the binding
3418
3374
  * @param value The string value to assign to the binding
3419
3375
  * @param description The description of the input
3420
3376
  */
3421
3377
  withStringInput: (name: string, value: string, description: string) => Env;
3422
3378
  /**
3423
- * Create or update an input value of type string
3379
+ * Declares a desired string output binding
3424
3380
  * @param name The name of the binding
3425
3381
  * @param description The description of the output
3426
3382
  */
3427
3383
  withStringOutput: (name: string, description: string) => Env;
3384
+ /**
3385
+ * Returns a new environment with the provided workspace
3386
+ * @param workspace The directory to set as the host filesystem
3387
+ */
3388
+ withWorkspace: (workspace: Directory) => Env;
3389
+ /**
3390
+ * Returns a new environment without any outputs
3391
+ */
3392
+ withoutOutputs: () => Env;
3393
+ workspace: () => Directory;
3428
3394
  /**
3429
3395
  * Call the provided function with current Env.
3430
3396
  *
@@ -3459,12 +3425,14 @@ export declare class EnvFile extends BaseClient {
3459
3425
  /**
3460
3426
  * Lookup a variable (last occurrence wins) and return its value, or an empty string
3461
3427
  * @param name Variable name
3428
+ * @param opts.raw Return the value exactly as written to the file. No quote removal or variable expansion
3462
3429
  */
3463
- get: (name: string) => Promise<string>;
3430
+ get: (name: string, opts?: EnvFileGetOpts) => Promise<string>;
3464
3431
  /**
3465
3432
  * Return all variables
3433
+ * @param opts.raw Return values exactly as written to the file. No quote removal or variable expansion
3466
3434
  */
3467
- variables: () => Promise<EnvVariable[]>;
3435
+ variables: (opts?: EnvFileVariablesOpts) => Promise<EnvVariable[]>;
3468
3436
  /**
3469
3437
  * Add a variable
3470
3438
  * @param name Variable name
@@ -4025,24 +3993,6 @@ export declare class GitRepository extends BaseClient {
4025
3993
  * The URL of the git repository.
4026
3994
  */
4027
3995
  url: () => Promise<string>;
4028
- /**
4029
- * Header to authenticate the remote with.
4030
- * @param header Secret used to populate the Authorization HTTP header
4031
- * @deprecated Use "httpAuthHeader" in the constructor instead.
4032
- */
4033
- withAuthHeader: (header: Secret) => GitRepository;
4034
- /**
4035
- * Token to authenticate the remote with.
4036
- * @param token Secret used to populate the password during basic HTTP Authorization
4037
- * @deprecated Use "httpAuthToken" in the constructor instead.
4038
- */
4039
- withAuthToken: (token: Secret) => GitRepository;
4040
- /**
4041
- * Call the provided function with current GitRepository.
4042
- *
4043
- * This is useful for reusability and readability by not breaking the calling chain.
4044
- */
4045
- with: (arg: (param: GitRepository) => GitRepository) => GitRepository;
4046
3996
  }
4047
3997
  /**
4048
3998
  * Information about the host environment.
@@ -4093,15 +4043,6 @@ export declare class Host extends BaseClient {
4093
4043
  * @param opts.host Upstream host to forward traffic to.
4094
4044
  */
4095
4045
  service: (ports: PortForward[], opts?: HostServiceOpts) => Service;
4096
- /**
4097
- * Sets a secret given a user-defined name and the file path on the host, and returns the secret.
4098
- *
4099
- * The file is limited to a size of 512000 bytes.
4100
- * @param name The user defined name for this secret.
4101
- * @param path Location of the file to set as a secret.
4102
- * @deprecated setSecretFile is superceded by use of the secret API with file:// URIs
4103
- */
4104
- setSecretFile: (name: string, path: string) => Secret;
4105
4046
  /**
4106
4047
  * Creates a tunnel that forwards traffic from the host to a service.
4107
4048
  * @param service Service to send traffic from the tunnel.
@@ -4266,16 +4207,18 @@ export declare class JSONValue extends BaseClient {
4266
4207
  }
4267
4208
  export declare class LLM extends BaseClient {
4268
4209
  private readonly _id?;
4210
+ private readonly _hasPrompt?;
4269
4211
  private readonly _historyJSON?;
4270
4212
  private readonly _lastReply?;
4271
4213
  private readonly _model?;
4272
4214
  private readonly _provider?;
4215
+ private readonly _step?;
4273
4216
  private readonly _sync?;
4274
4217
  private readonly _tools?;
4275
4218
  /**
4276
4219
  * Constructor is used for internal usage only, do not create object from it.
4277
4220
  */
4278
- constructor(ctx?: Context, _id?: LLMID, _historyJSON?: JSON, _lastReply?: string, _model?: string, _provider?: string, _sync?: LLMID, _tools?: string);
4221
+ constructor(ctx?: Context, _id?: LLMID, _hasPrompt?: boolean, _historyJSON?: JSON, _lastReply?: string, _model?: string, _provider?: string, _step?: LLMID, _sync?: LLMID, _tools?: string);
4279
4222
  /**
4280
4223
  * A unique identifier for this LLM.
4281
4224
  */
@@ -4292,6 +4235,10 @@ export declare class LLM extends BaseClient {
4292
4235
  * return the LLM's current environment
4293
4236
  */
4294
4237
  env: () => Env;
4238
+ /**
4239
+ * Indicates whether there are any queued prompts or tool results to send to the model
4240
+ */
4241
+ hasPrompt: () => Promise<boolean>;
4295
4242
  /**
4296
4243
  * return the llm message history
4297
4244
  */
@@ -4305,7 +4252,7 @@ export declare class LLM extends BaseClient {
4305
4252
  */
4306
4253
  lastReply: () => Promise<string>;
4307
4254
  /**
4308
- * synchronize LLM state
4255
+ * Submit the queued prompt, evaluate any tool calls, queue their results, and keep going until the model ends its turn
4309
4256
  */
4310
4257
  loop: () => LLM;
4311
4258
  /**
@@ -4316,6 +4263,10 @@ export declare class LLM extends BaseClient {
4316
4263
  * return the provider used by the llm
4317
4264
  */
4318
4265
  provider: () => Promise<string>;
4266
+ /**
4267
+ * Submit the queued prompt or tool call results, evaluate any tool calls, and queue their results
4268
+ */
4269
+ step: () => Promise<LLM>;
4319
4270
  /**
4320
4271
  * synchronize LLM state
4321
4272
  */
@@ -4328,10 +4279,24 @@ export declare class LLM extends BaseClient {
4328
4279
  * print documentation for available tools
4329
4280
  */
4330
4281
  tools: () => Promise<string>;
4282
+ /**
4283
+ * Return a new LLM with the specified function no longer exposed as a tool
4284
+ * @param typeName The type name whose function will be blocked
4285
+ * @param function The function to block
4286
+ *
4287
+ * Will be converted to lowerCamelCase if necessary.
4288
+ */
4289
+ withBlockedFunction: (typeName: string, function_: string) => LLM;
4331
4290
  /**
4332
4291
  * allow the LLM to interact with an environment via MCP
4333
4292
  */
4334
4293
  withEnv: (env: Env) => LLM;
4294
+ /**
4295
+ * Add an external MCP server to the LLM
4296
+ * @param name The name of the MCP server
4297
+ * @param service The MCP service to run and communicate with over stdio
4298
+ */
4299
+ withMCPServer: (name: string, service: Service) => LLM;
4335
4300
  /**
4336
4301
  * swap out the llm model
4337
4302
  * @param model The model to use
@@ -4347,6 +4312,10 @@ export declare class LLM extends BaseClient {
4347
4312
  * @param file The file to read the prompt from
4348
4313
  */
4349
4314
  withPromptFile: (file: File) => LLM;
4315
+ /**
4316
+ * Use a static set of tools for method calls, e.g. for MCP clients that do not support dynamic tool registration
4317
+ */
4318
+ withStaticTools: () => LLM;
4350
4319
  /**
4351
4320
  * Add a system prompt to the LLM's environment
4352
4321
  * @param prompt The system prompt to send
@@ -4872,6 +4841,15 @@ export declare class Client extends BaseClient {
4872
4841
  * @param opts.platform Platform to initialize the container with. Defaults to the native platform of the current engine
4873
4842
  */
4874
4843
  container: (opts?: ClientContainerOpts) => Container;
4844
+ /**
4845
+ * Returns the current environment
4846
+ *
4847
+ * 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.
4848
+ *
4849
+ * 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.
4850
+ * @experimental
4851
+ */
4852
+ currentEnv: () => Env;
4875
4853
  /**
4876
4854
  * The FunctionCall context that the SDK caller is currently executing in.
4877
4855
  *
@@ -4899,7 +4877,7 @@ export declare class Client extends BaseClient {
4899
4877
  */
4900
4878
  engine: () => Engine;
4901
4879
  /**
4902
- * Initialize a new environment
4880
+ * Initializes a new environment
4903
4881
  * @param opts.privileged Give the environment the same privileges as the caller: core API including host access, current module, and dependencies
4904
4882
  * @param opts.writable Allow new outputs to be declared and saved in the environment
4905
4883
  * @experimental