@dagger.io/dagger 0.18.2 → 0.18.4

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.
@@ -145,16 +145,20 @@ export var TypeDefKind;
145
145
  })(TypeDefKind || (TypeDefKind = {}));
146
146
  export class Binding extends BaseClient {
147
147
  _id = undefined;
148
+ _asString = undefined;
148
149
  _digest = undefined;
150
+ _isNull = undefined;
149
151
  _name = undefined;
150
152
  _typeName = undefined;
151
153
  /**
152
154
  * Constructor is used for internal usage only, do not create object from it.
153
155
  */
154
- constructor(ctx, _id, _digest, _name, _typeName) {
156
+ constructor(ctx, _id, _asString, _digest, _isNull, _name, _typeName) {
155
157
  super(ctx);
156
158
  this._id = _id;
159
+ this._asString = _asString;
157
160
  this._digest = _digest;
161
+ this._isNull = _isNull;
158
162
  this._name = _name;
159
163
  this._typeName = _typeName;
160
164
  }
@@ -267,6 +271,17 @@ export class Binding extends BaseClient {
267
271
  const ctx = this._ctx.select("asSocket");
268
272
  return new Socket(ctx);
269
273
  };
274
+ /**
275
+ * The binding's string value
276
+ */
277
+ asString = async () => {
278
+ if (this._asString) {
279
+ return this._asString;
280
+ }
281
+ const ctx = this._ctx.select("asString");
282
+ const response = await ctx.execute();
283
+ return response;
284
+ };
270
285
  /**
271
286
  * The digest of the binding value
272
287
  */
@@ -278,6 +293,17 @@ export class Binding extends BaseClient {
278
293
  const response = await ctx.execute();
279
294
  return response;
280
295
  };
296
+ /**
297
+ * Returns true if the binding is null
298
+ */
299
+ isNull = async () => {
300
+ if (this._isNull) {
301
+ return this._isNull;
302
+ }
303
+ const ctx = this._ctx.select("isNull");
304
+ const response = await ctx.execute();
305
+ return response;
306
+ };
281
307
  /**
282
308
  * The binding name
283
309
  */
@@ -383,8 +409,6 @@ export class Container extends BaseClient {
383
409
  * If empty, the container's default command is used.
384
410
  * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
385
411
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
386
- *
387
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
388
412
  * @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.
389
413
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
390
414
  * @param opts.noInit If set, skip the automatic init process injected into containers by default.
@@ -396,7 +420,7 @@ export class Container extends BaseClient {
396
420
  return new Service(ctx);
397
421
  };
398
422
  /**
399
- * Returns a File representing the container serialized to a tarball.
423
+ * Package the container state as an OCI image, and return it as a tar archive
400
424
  * @param opts.platformVariants Identifiers for other platform specific containers.
401
425
  *
402
426
  * Used for multi-platform images.
@@ -426,13 +450,16 @@ export class Container extends BaseClient {
426
450
  * They will be mounted at /run/secrets/[secret-name] in the build container
427
451
  *
428
452
  * 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))
453
+ * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements.
454
+ *
455
+ * 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.
429
456
  */
430
457
  build = (context, opts) => {
431
458
  const ctx = this._ctx.select("build", { context, ...opts });
432
459
  return new Container(ctx);
433
460
  };
434
461
  /**
435
- * Retrieves default arguments for future commands.
462
+ * Return the container's default arguments.
436
463
  */
437
464
  defaultArgs = async () => {
438
465
  const ctx = this._ctx.select("defaultArgs");
@@ -440,7 +467,7 @@ export class Container extends BaseClient {
440
467
  return response;
441
468
  };
442
469
  /**
443
- * Retrieves a directory at the given path.
470
+ * Retrieve a directory from the container's root filesystem
444
471
  *
445
472
  * Mounts are included.
446
473
  * @param path The path of the directory to retrieve (e.g., "./src").
@@ -451,7 +478,7 @@ export class Container extends BaseClient {
451
478
  return new Directory(ctx);
452
479
  };
453
480
  /**
454
- * Retrieves entrypoint to be prepended to the arguments of all commands.
481
+ * Return the container's OCI entrypoint.
455
482
  */
456
483
  entrypoint = async () => {
457
484
  const ctx = this._ctx.select("entrypoint");
@@ -479,9 +506,9 @@ export class Container extends BaseClient {
479
506
  return response.map((r) => new Client(ctx.copy()).loadEnvVariableFromID(r.id));
480
507
  };
481
508
  /**
482
- * The exit code of the last executed command.
509
+ * The exit code of the last executed command
483
510
  *
484
- * Returns an error if no command was set.
511
+ * Returns an error if no command was executed
485
512
  */
486
513
  exitCode = async () => {
487
514
  if (this._exitCode) {
@@ -570,10 +597,8 @@ export class Container extends BaseClient {
570
597
  return new File(ctx);
571
598
  };
572
599
  /**
573
- * Initializes this container from a pulled base image.
574
- * @param address Image's address from its registry.
575
- *
576
- * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
600
+ * Download a container image, and apply it to the container state. All previous state will be lost.
601
+ * @param address Address of the container image to download, in standard OCI ref format. Example:"registry.dagger.io/engine:latest"
577
602
  */
578
603
  from = (address) => {
579
604
  const ctx = this._ctx.select("from", { address });
@@ -639,14 +664,12 @@ export class Container extends BaseClient {
639
664
  return response;
640
665
  };
641
666
  /**
642
- * Publishes this container as a new image to the specified address.
667
+ * Package the container state as an OCI image, and publish it to a registry
643
668
  *
644
- * Publish returns a fully qualified ref.
669
+ * Returns the fully qualified address of the published image, with digest
670
+ * @param address The OCI address to publish to
645
671
  *
646
- * It can also publish platform variants.
647
- * @param address Registry's address to publish the image to.
648
- *
649
- * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
672
+ * Same format as "docker push". Example: "registry.example.com/user/repo:tag"
650
673
  * @param opts.platformVariants Identifiers for other platform specific containers.
651
674
  *
652
675
  * Used for multi-platform image.
@@ -655,7 +678,7 @@ export class Container extends BaseClient {
655
678
  * 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.
656
679
  * @param opts.mediaTypes Use the specified media types for the published image's layers.
657
680
  *
658
- * Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
681
+ * Defaults to "OCI", which is compatible with most recent registries, but "Docker" may be needed for older registries without OCI support.
659
682
  */
660
683
  publish = async (address, opts) => {
661
684
  if (this._publish) {
@@ -674,16 +697,16 @@ export class Container extends BaseClient {
674
697
  return response;
675
698
  };
676
699
  /**
677
- * Retrieves this container's root filesystem. Mounts are not included.
700
+ * 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.
678
701
  */
679
702
  rootfs = () => {
680
703
  const ctx = this._ctx.select("rootfs");
681
704
  return new Directory(ctx);
682
705
  };
683
706
  /**
684
- * The error stream of the last executed command.
707
+ * The buffered standard error stream of the last executed command
685
708
  *
686
- * Returns an error if no command was set.
709
+ * Returns an error if no command was executed
687
710
  */
688
711
  stderr = async () => {
689
712
  if (this._stderr) {
@@ -694,9 +717,9 @@ export class Container extends BaseClient {
694
717
  return response;
695
718
  };
696
719
  /**
697
- * The output stream of the last executed command.
720
+ * The buffered standard output stream of the last executed command
698
721
  *
699
- * Returns an error if no command was set.
722
+ * Returns an error if no command was executed
700
723
  */
701
724
  stdout = async () => {
702
725
  if (this._stdout) {
@@ -720,8 +743,6 @@ export class Container extends BaseClient {
720
743
  * Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default).
721
744
  * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead.
722
745
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
723
- *
724
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
725
746
  * @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.
726
747
  */
727
748
  terminal = (opts) => {
@@ -741,8 +762,6 @@ export class Container extends BaseClient {
741
762
  * If empty, the container's default command is used.
742
763
  * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
743
764
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
744
- *
745
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
746
765
  * @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.
747
766
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
748
767
  * @param opts.noInit If set, skip the automatic init process injected into containers by default.
@@ -777,7 +796,7 @@ export class Container extends BaseClient {
777
796
  return new Container(ctx);
778
797
  };
779
798
  /**
780
- * Configures default arguments for future commands.
799
+ * Configures default arguments for future commands. Like CMD in Dockerfile.
781
800
  * @param args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
782
801
  */
783
802
  withDefaultArgs = (args) => {
@@ -788,8 +807,6 @@ export class Container extends BaseClient {
788
807
  * Set the default command to invoke for the container's terminal API.
789
808
  * @param args The args of the command.
790
809
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
791
- *
792
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
793
810
  * @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.
794
811
  */
795
812
  withDefaultTerminalCmd = (args, opts) => {
@@ -797,7 +814,7 @@ export class Container extends BaseClient {
797
814
  return new Container(ctx);
798
815
  };
799
816
  /**
800
- * Retrieves this container plus a directory written at the given path.
817
+ * Return a new container snapshot, with a directory added to its filesystem
801
818
  * @param path Location of the written directory (e.g., "/tmp/directory").
802
819
  * @param directory Identifier of the directory to write
803
820
  * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
@@ -814,18 +831,18 @@ export class Container extends BaseClient {
814
831
  return new Container(ctx);
815
832
  };
816
833
  /**
817
- * Retrieves this container but with a different command entrypoint.
818
- * @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
819
- * @param opts.keepDefaultArgs Don't remove the default arguments when setting the entrypoint.
834
+ * Set an OCI-style entrypoint. It will be included in the container's OCI configuration. Note, withExec ignores the entrypoint by default.
835
+ * @param args Arguments of the entrypoint. Example: ["go", "run"].
836
+ * @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.
820
837
  */
821
838
  withEntrypoint = (args, opts) => {
822
839
  const ctx = this._ctx.select("withEntrypoint", { args, ...opts });
823
840
  return new Container(ctx);
824
841
  };
825
842
  /**
826
- * Retrieves this container plus the given environment variable.
827
- * @param name The name of the environment variable (e.g., "HOST").
828
- * @param value The value of the environment variable. (e.g., "localhost").
843
+ * Set a new environment variable in the container.
844
+ * @param name Name of the environment variable (e.g., "HOST").
845
+ * @param value Value of the environment variable. (e.g., "localhost").
829
846
  * @param opts.expand Replace "${VAR}" or "$VAR" in the value according to the current environment variables defined in the container (e.g. "/opt/bin:$PATH").
830
847
  */
831
848
  withEnvVariable = (name, value, opts) => {
@@ -833,23 +850,25 @@ export class Container extends BaseClient {
833
850
  return new Container(ctx);
834
851
  };
835
852
  /**
836
- * Retrieves this container after executing the specified command inside it.
837
- * @param args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]).
853
+ * Execute a command in the container, and return a new snapshot of the container state after execution.
854
+ * @param args Command to execute. Must be valid exec() arguments, not a shell command. Example: ["go", "run", "main.go"].
838
855
  *
839
- * If empty, the container's default command is used.
840
- * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
841
- * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
842
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
843
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
856
+ * To run a shell command, execute the shell and pass the shell command as argument. Example: ["sh", "-c", "ls -l | grep foo"]
857
+ *
858
+ * Defaults to the container's default arguments (see "defaultArgs" and "withDefaultArgs").
859
+ * @param opts.useEntrypoint Apply the OCI entrypoint, if present, by prepending it to the args. Ignored by default.
860
+ * @param opts.stdin Content to write to the command's standard input. Example: "Hello world")
861
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container. Example: "./stdout.txt"
862
+ * @param opts.redirectStderr Like redirectStdout, but for standard error
844
863
  * @param opts.expect Exit codes this command is allowed to exit with without error
845
864
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
865
+ * @param opts.insecureRootCapabilities Execute the command with all root capabilities. Like --privileged in Docker
846
866
  *
847
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
848
- * @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.
867
+ * DANGER: this grants the command full access to the host system. Only use when 1) you trust the command being executed and 2) you specifically need this level of access.
849
868
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
850
- * @param opts.noInit If set, skip the automatic init process injected into containers by default.
869
+ * @param opts.noInit Skip the automatic init process injected into containers by default.
851
870
  *
852
- * 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.
871
+ * Only use this if you specifically need the command to be pid 1 in the container. Otherwise it may result in unexpected behavior. If you're not sure, you don't need this.
853
872
  */
854
873
  withExec = (args, opts) => {
855
874
  const metadata = {
@@ -863,16 +882,16 @@ export class Container extends BaseClient {
863
882
  return new Container(ctx);
864
883
  };
865
884
  /**
866
- * Expose a network port.
885
+ * Expose a network port. Like EXPOSE in Dockerfile (but with healthcheck support)
867
886
  *
868
887
  * Exposed ports serve two purposes:
869
888
  *
870
889
  * - For health checks and introspection, when running services
871
890
  *
872
891
  * - For setting the EXPOSE OCI field when publishing the container
873
- * @param port Port number to expose
874
- * @param opts.protocol Transport layer network protocol
875
- * @param opts.description Optional port description
892
+ * @param port Port number to expose. Example: 8080
893
+ * @param opts.protocol Network protocol. Example: "tcp"
894
+ * @param opts.description Port description. Example: "payment API endpoint"
876
895
  * @param opts.experimentalSkipHealthcheck Skip the health check when run as a service.
877
896
  */
878
897
  withExposedPort = (port, opts) => {
@@ -887,10 +906,10 @@ export class Container extends BaseClient {
887
906
  return new Container(ctx);
888
907
  };
889
908
  /**
890
- * Retrieves this container plus the contents of the given file copied to the given path.
891
- * @param path Location of the copied file (e.g., "/tmp/file.txt").
892
- * @param source Identifier of the file to copy.
893
- * @param opts.permissions Permission given to the copied file (e.g., 0600).
909
+ * Return a container snapshot with a file added
910
+ * @param path Path of the new file. Example: "/path/to/new-file.txt"
911
+ * @param source File to add
912
+ * @param opts.permissions Permissions of the new file. Example: 0600
894
913
  * @param opts.owner A user:group to set for the file.
895
914
  *
896
915
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1017,10 +1036,10 @@ export class Container extends BaseClient {
1017
1036
  return new Container(ctx);
1018
1037
  };
1019
1038
  /**
1020
- * Retrieves this container plus a new file written at the given path.
1021
- * @param path Location of the written file (e.g., "/tmp/file.txt").
1022
- * @param contents Content of the file to write (e.g., "Hello world!").
1023
- * @param opts.permissions Permission given to the written file (e.g., 0600).
1039
+ * Return a new container snapshot, with a file added to its filesystem with text content
1040
+ * @param path Path of the new file. May be relative or absolute. Example: "README.md" or "/etc/profile"
1041
+ * @param contents Contents of the new file. Example: "Hello world!"
1042
+ * @param opts.permissions Permissions of the new file. Example: 0600
1024
1043
  * @param opts.owner A user:group to set for the file.
1025
1044
  *
1026
1045
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1033,12 +1052,10 @@ export class Container extends BaseClient {
1033
1052
  return new Container(ctx);
1034
1053
  };
1035
1054
  /**
1036
- * Retrieves this container with a registry authentication for a given address.
1037
- * @param address Registry's address to bind the authentication to.
1038
- *
1039
- * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1040
- * @param username The username of the registry's account (e.g., "Dagger").
1041
- * @param secret The API key, password or token to authenticate to this registry.
1055
+ * Attach credentials for future publishing to a registry. Use in combination with publish
1056
+ * @param address The image address that needs authentication. Same format as "docker push". Example: "registry.dagger.io/dagger:latest"
1057
+ * @param username The username to authenticate with. Example: "alice"
1058
+ * @param secret The API key, password or token to authenticate to this registry
1042
1059
  */
1043
1060
  withRegistryAuth = (address, username, secret) => {
1044
1061
  const ctx = this._ctx.select("withRegistryAuth", {
@@ -1049,32 +1066,32 @@ export class Container extends BaseClient {
1049
1066
  return new Container(ctx);
1050
1067
  };
1051
1068
  /**
1052
- * Retrieves the container with the given directory mounted to /.
1053
- * @param directory Directory to mount.
1069
+ * Change the container's root filesystem. The previous root filesystem will be lost.
1070
+ * @param directory The new root filesystem.
1054
1071
  */
1055
1072
  withRootfs = (directory) => {
1056
1073
  const ctx = this._ctx.select("withRootfs", { directory });
1057
1074
  return new Container(ctx);
1058
1075
  };
1059
1076
  /**
1060
- * Retrieves this container plus an env variable containing the given secret.
1061
- * @param name The name of the secret variable (e.g., "API_SECRET").
1062
- * @param secret The identifier of the secret value.
1077
+ * Set a new environment variable, using a secret value
1078
+ * @param name Name of the secret variable (e.g., "API_SECRET").
1079
+ * @param secret Identifier of the secret value.
1063
1080
  */
1064
1081
  withSecretVariable = (name, secret) => {
1065
1082
  const ctx = this._ctx.select("withSecretVariable", { name, secret });
1066
1083
  return new Container(ctx);
1067
1084
  };
1068
1085
  /**
1069
- * Establish a runtime dependency on a service.
1086
+ * Establish a runtime dependency on a from a container to a network service.
1070
1087
  *
1071
1088
  * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set.
1072
1089
  *
1073
1090
  * The service will be reachable from the container via the provided hostname alias.
1074
1091
  *
1075
1092
  * The service dependency will also convey to any files or directories produced by the container.
1076
- * @param alias A name that can be used to reach the service from the container
1077
- * @param service Identifier of the service container
1093
+ * @param alias Hostname that will resolve to the target service (only accessible from within this container)
1094
+ * @param service The target service
1078
1095
  */
1079
1096
  withServiceBinding = (alias, service) => {
1080
1097
  const ctx = this._ctx.select("withServiceBinding", { alias, service });
@@ -1104,7 +1121,7 @@ export class Container extends BaseClient {
1104
1121
  return new Container(ctx);
1105
1122
  };
1106
1123
  /**
1107
- * Retrieves this container with a different working directory.
1124
+ * Change the container's working directory. Like WORKDIR in Dockerfile.
1108
1125
  * @param path The path to set as the working directory (e.g., "/app").
1109
1126
  * @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").
1110
1127
  */
@@ -1121,14 +1138,14 @@ export class Container extends BaseClient {
1121
1138
  return new Container(ctx);
1122
1139
  };
1123
1140
  /**
1124
- * Retrieves this container with unset default arguments for future commands.
1141
+ * Remove the container's default arguments.
1125
1142
  */
1126
1143
  withoutDefaultArgs = () => {
1127
1144
  const ctx = this._ctx.select("withoutDefaultArgs");
1128
1145
  return new Container(ctx);
1129
1146
  };
1130
1147
  /**
1131
- * Retrieves this container with the directory at the given path removed.
1148
+ * Return a new container snapshot, with a directory removed from its filesystem
1132
1149
  * @param path Location of the directory to remove (e.g., ".github/").
1133
1150
  * @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").
1134
1151
  */
@@ -1137,7 +1154,7 @@ export class Container extends BaseClient {
1137
1154
  return new Container(ctx);
1138
1155
  };
1139
1156
  /**
1140
- * Retrieves this container with an unset command entrypoint.
1157
+ * Reset the container's OCI entrypoint.
1141
1158
  * @param opts.keepDefaultArgs Don't remove the default arguments when unsetting the entrypoint.
1142
1159
  */
1143
1160
  withoutEntrypoint = (opts) => {
@@ -1178,8 +1195,8 @@ export class Container extends BaseClient {
1178
1195
  return new Container(ctx);
1179
1196
  };
1180
1197
  /**
1181
- * Retrieves this container with the files at the given paths removed.
1182
- * @param paths Location of the files to remove (e.g., ["/file.txt"]).
1198
+ * Return a new container spanshot with specified files removed
1199
+ * @param paths Paths of the files to remove. Example: ["foo.txt, "/root/.ssh/config"
1183
1200
  * @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").
1184
1201
  */
1185
1202
  withoutFiles = (paths, opts) => {
@@ -1240,7 +1257,7 @@ export class Container extends BaseClient {
1240
1257
  return new Container(ctx);
1241
1258
  };
1242
1259
  /**
1243
- * Retrieves this container with an unset working directory.
1260
+ * Unset the container's working directory.
1244
1261
  *
1245
1262
  * Should default to "/".
1246
1263
  */
@@ -1362,7 +1379,7 @@ export class Directory extends BaseClient {
1362
1379
  return response;
1363
1380
  };
1364
1381
  /**
1365
- * Converts this directory into a git repository
1382
+ * Converts this directory to a local git repository
1366
1383
  */
1367
1384
  asGit = () => {
1368
1385
  const ctx = this._ctx.select("asGit");
@@ -1389,8 +1406,8 @@ export class Directory extends BaseClient {
1389
1406
  return new ModuleSource(ctx);
1390
1407
  };
1391
1408
  /**
1392
- * Gets the difference between this directory and an another directory.
1393
- * @param other Identifier of the directory to compare.
1409
+ * Return the difference between this directory and an another directory. The difference is encoded as a directory.
1410
+ * @param other The directory to compare against
1394
1411
  */
1395
1412
  diff = (other) => {
1396
1413
  const ctx = this._ctx.select("diff", { other });
@@ -1409,14 +1426,14 @@ export class Directory extends BaseClient {
1409
1426
  };
1410
1427
  /**
1411
1428
  * Retrieves a directory at the given path.
1412
- * @param path Location of the directory to retrieve (e.g., "/src").
1429
+ * @param path Location of the directory to retrieve. Example: "/src"
1413
1430
  */
1414
1431
  directory = (path) => {
1415
1432
  const ctx = this._ctx.select("directory", { path });
1416
1433
  return new Directory(ctx);
1417
1434
  };
1418
1435
  /**
1419
- * Builds a new Docker container from this directory.
1436
+ * 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.
1420
1437
  * @param opts.platform The platform to build.
1421
1438
  * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1422
1439
  * @param opts.target Target build stage to build.
@@ -1424,6 +1441,9 @@ export class Directory extends BaseClient {
1424
1441
  * @param opts.secrets Secrets to pass to the build.
1425
1442
  *
1426
1443
  * They will be mounted at /run/secrets/[secret-name].
1444
+ * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements.
1445
+ *
1446
+ * 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.
1427
1447
  */
1428
1448
  dockerBuild = (opts) => {
1429
1449
  const ctx = this._ctx.select("dockerBuild", { ...opts });
@@ -1452,7 +1472,7 @@ export class Directory extends BaseClient {
1452
1472
  return response;
1453
1473
  };
1454
1474
  /**
1455
- * Retrieves a file at the given path.
1475
+ * Retrieve a file at the given path.
1456
1476
  * @param path Location of the file to retrieve (e.g., "README.md").
1457
1477
  */
1458
1478
  file = (path) => {
@@ -1460,9 +1480,9 @@ export class Directory extends BaseClient {
1460
1480
  return new File(ctx);
1461
1481
  };
1462
1482
  /**
1463
- * Retrieves this directory as per exclude/include filters.
1464
- * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1465
- * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1483
+ * Return a snapshot with some paths included or excluded
1484
+ * @param opts.exclude If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"]
1485
+ * @param opts.include If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]).
1466
1486
  */
1467
1487
  filter = (opts) => {
1468
1488
  const ctx = this._ctx.select("filter", { ...opts });
@@ -1500,8 +1520,6 @@ export class Directory extends BaseClient {
1500
1520
  * Opens an interactive terminal in new container with this directory mounted inside.
1501
1521
  * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead.
1502
1522
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1503
- *
1504
- * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
1505
1523
  * @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.
1506
1524
  * @param opts.container If set, override the default container used for the terminal.
1507
1525
  */
@@ -1510,7 +1528,7 @@ export class Directory extends BaseClient {
1510
1528
  return new Directory(ctx);
1511
1529
  };
1512
1530
  /**
1513
- * Retrieves this directory plus a directory written at the given path.
1531
+ * Return a snapshot with a directory added
1514
1532
  * @param path Location of the written directory (e.g., "/src/").
1515
1533
  * @param directory Identifier of the directory to copy.
1516
1534
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
@@ -1550,10 +1568,10 @@ export class Directory extends BaseClient {
1550
1568
  return new Directory(ctx);
1551
1569
  };
1552
1570
  /**
1553
- * Retrieves this directory plus a new file written at the given path.
1554
- * @param path Location of the written file (e.g., "/file.txt").
1555
- * @param contents Content of the written file (e.g., "Hello world!").
1556
- * @param opts.permissions Permission given to the copied file (e.g., 0600).
1571
+ * Return a snapshot with a new file added
1572
+ * @param path Path of the new file. Example: "foo/bar.txt"
1573
+ * @param contents Contents of the new file. Example: "Hello world!"
1574
+ * @param opts.permissions Permissions of the new file. Example: 0600
1557
1575
  */
1558
1576
  withNewFile = (path, contents, opts) => {
1559
1577
  const ctx = this._ctx.select("withNewFile", { path, contents, ...opts });
@@ -1570,24 +1588,24 @@ export class Directory extends BaseClient {
1570
1588
  return new Directory(ctx);
1571
1589
  };
1572
1590
  /**
1573
- * Retrieves this directory with the directory at the given path removed.
1574
- * @param path Location of the directory to remove (e.g., ".github/").
1591
+ * Return a snapshot with a subdirectory removed
1592
+ * @param path Path of the subdirectory to remove. Example: ".github/workflows"
1575
1593
  */
1576
1594
  withoutDirectory = (path) => {
1577
1595
  const ctx = this._ctx.select("withoutDirectory", { path });
1578
1596
  return new Directory(ctx);
1579
1597
  };
1580
1598
  /**
1581
- * Retrieves this directory with the file at the given path removed.
1582
- * @param path Location of the file to remove (e.g., "/file.txt").
1599
+ * Return a snapshot with a file removed
1600
+ * @param path Path of the file to remove (e.g., "/file.txt").
1583
1601
  */
1584
1602
  withoutFile = (path) => {
1585
1603
  const ctx = this._ctx.select("withoutFile", { path });
1586
1604
  return new Directory(ctx);
1587
1605
  };
1588
1606
  /**
1589
- * Retrieves this directory with the files at the given paths removed.
1590
- * @param paths Location of the file to remove (e.g., ["/file.txt"]).
1607
+ * Return a snapshot with files removed
1608
+ * @param paths Paths of the files to remove (e.g., ["/file.txt"]).
1591
1609
  */
1592
1610
  withoutFiles = (paths) => {
1593
1611
  const ctx = this._ctx.select("withoutFiles", { paths });
@@ -2381,6 +2399,7 @@ export class Env extends BaseClient {
2381
2399
  * Create or update an input value of type string
2382
2400
  * @param name The name of the binding
2383
2401
  * @param value The string value to assign to the binding
2402
+ * @param description The description of the input
2384
2403
  */
2385
2404
  withStringInput = (name, value, description) => {
2386
2405
  const ctx = this._ctx.select("withStringInput", {
@@ -2390,6 +2409,15 @@ export class Env extends BaseClient {
2390
2409
  });
2391
2410
  return new Env(ctx);
2392
2411
  };
2412
+ /**
2413
+ * Create or update an input value of type string
2414
+ * @param name The name of the binding
2415
+ * @param description The description of the output
2416
+ */
2417
+ withStringOutput = (name, description) => {
2418
+ const ctx = this._ctx.select("withStringOutput", { name, description });
2419
+ return new Env(ctx);
2420
+ };
2393
2421
  /**
2394
2422
  * Call the provided function with current Env.
2395
2423
  *
@@ -3377,6 +3405,7 @@ export class Host extends BaseClient {
3377
3405
  * The file is limited to a size of 512000 bytes.
3378
3406
  * @param name The user defined name for this secret.
3379
3407
  * @param path Location of the file to set as a secret.
3408
+ * @deprecated setSecretFile is superceded by use of the secret API with file:// URIs
3380
3409
  */
3381
3410
  setSecretFile = (name, path) => {
3382
3411
  const ctx = this._ctx.select("setSecretFile", { name, path });
@@ -3714,6 +3743,13 @@ export class LLM extends BaseClient {
3714
3743
  const ctx = this._ctx.select("withSystemPrompt", { prompt });
3715
3744
  return new LLM(ctx);
3716
3745
  };
3746
+ /**
3747
+ * Disable the default system prompt
3748
+ */
3749
+ withoutDefaultSystemPrompt = () => {
3750
+ const ctx = this._ctx.select("withoutDefaultSystemPrompt");
3751
+ return new LLM(ctx);
3752
+ };
3717
3753
  /**
3718
3754
  * Call the provided function with current LLM.
3719
3755
  *
@@ -4480,6 +4516,14 @@ export class ModuleSource extends BaseClient {
4480
4516
  const ctx = this._ctx.select("withUpdateDependencies", { dependencies });
4481
4517
  return new ModuleSource(ctx);
4482
4518
  };
4519
+ /**
4520
+ * Remove a client from the module source.
4521
+ * @param path The path of the client to remove.
4522
+ */
4523
+ withoutClient = (path) => {
4524
+ const ctx = this._ctx.select("withoutClient", { path });
4525
+ return new ModuleSource(ctx);
4526
+ };
4483
4527
  /**
4484
4528
  * Remove the provided dependencies from the module source's dependency list.
4485
4529
  * @param dependencies The dependencies to remove.
@@ -4695,10 +4739,10 @@ export class Client extends BaseClient {
4695
4739
  return new CacheVolume(ctx);
4696
4740
  };
4697
4741
  /**
4698
- * Creates a scratch container.
4742
+ * Creates a scratch container, with no image or metadata.
4699
4743
  *
4700
- * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
4701
- * @param opts.platform Platform to initialize the container with.
4744
+ * To pull an image, follow up with the "from" function.
4745
+ * @param opts.platform Platform to initialize the container with. Defaults to the native platform of the current engine
4702
4746
  */
4703
4747
  container = (opts) => {
4704
4748
  const ctx = this._ctx.select("container", { ...opts });
@@ -4753,6 +4797,8 @@ export class Client extends BaseClient {
4753
4797
  /**
4754
4798
  * Initialize a new environment
4755
4799
  * @param opts.privileged Give the environment the same privileges as the caller: core API including host access, current module, and dependencies
4800
+ * @param opts.writable Allow new outputs to be declared and saved in the environment
4801
+ * @experimental
4756
4802
  */
4757
4803
  env = (opts) => {
4758
4804
  const ctx = this._ctx.select("env", { ...opts });
@@ -4818,6 +4864,7 @@ export class Client extends BaseClient {
4818
4864
  * Initialize a Large Language Model (LLM)
4819
4865
  * @param opts.model Model to use
4820
4866
  * @param opts.maxAPICalls Cap the number of API calls for this LLM
4867
+ * @experimental
4821
4868
  */
4822
4869
  llm = (opts) => {
4823
4870
  const ctx = this._ctx.select("llm", { ...opts });
@@ -5096,13 +5143,6 @@ export class Client extends BaseClient {
5096
5143
  const ctx = this._ctx.select("loadSecretFromID", { id });
5097
5144
  return new Secret(ctx);
5098
5145
  };
5099
- /**
5100
- * Load a Secret from its Name.
5101
- */
5102
- loadSecretFromName = (name, opts) => {
5103
- const ctx = this._ctx.select("loadSecretFromName", { name, ...opts });
5104
- return new Secret(ctx);
5105
- };
5106
5146
  /**
5107
5147
  * Load a Service from its ID.
5108
5148
  */