@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.
@@ -66,8 +66,6 @@ export type ContainerAsServiceOpts = {
66
66
  useEntrypoint?: boolean;
67
67
  /**
68
68
  * Provides Dagger access to the executed command.
69
- *
70
- * 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.
71
69
  */
72
70
  experimentalPrivilegedNesting?: boolean;
73
71
  /**
@@ -126,6 +124,12 @@ export type ContainerBuildOpts = {
126
124
  * 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))
127
125
  */
128
126
  secrets?: Secret[];
127
+ /**
128
+ * If set, skip the automatic init process injected into containers created by RUN statements.
129
+ *
130
+ * 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.
131
+ */
132
+ noInit?: boolean;
129
133
  };
130
134
  export type ContainerDirectoryOpts = {
131
135
  /**
@@ -185,7 +189,7 @@ export type ContainerPublishOpts = {
185
189
  /**
186
190
  * Use the specified media types for the published image's layers.
187
191
  *
188
- * Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
192
+ * Defaults to "OCI", which is compatible with most recent registries, but "Docker" may be needed for older registries without OCI support.
189
193
  */
190
194
  mediaTypes?: ImageMediaTypes;
191
195
  };
@@ -196,8 +200,6 @@ export type ContainerTerminalOpts = {
196
200
  cmd?: string[];
197
201
  /**
198
202
  * Provides Dagger access to the executed command.
199
- *
200
- * 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.
201
203
  */
202
204
  experimentalPrivilegedNesting?: boolean;
203
205
  /**
@@ -228,8 +230,6 @@ export type ContainerUpOpts = {
228
230
  useEntrypoint?: boolean;
229
231
  /**
230
232
  * Provides Dagger access to the executed command.
231
- *
232
- * 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.
233
233
  */
234
234
  experimentalPrivilegedNesting?: boolean;
235
235
  /**
@@ -250,8 +250,6 @@ export type ContainerUpOpts = {
250
250
  export type ContainerWithDefaultTerminalCmdOpts = {
251
251
  /**
252
252
  * Provides Dagger access to the executed command.
253
- *
254
- * 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.
255
253
  */
256
254
  experimentalPrivilegedNesting?: boolean;
257
255
  /**
@@ -283,7 +281,7 @@ export type ContainerWithDirectoryOpts = {
283
281
  };
284
282
  export type ContainerWithEntrypointOpts = {
285
283
  /**
286
- * Don't remove the default arguments when setting the entrypoint.
284
+ * Don't reset the default arguments when setting the entrypoint. By default it is reset, since entrypoint and default args are often tightly coupled.
287
285
  */
288
286
  keepDefaultArgs?: boolean;
289
287
  };
@@ -295,19 +293,19 @@ export type ContainerWithEnvVariableOpts = {
295
293
  };
296
294
  export type ContainerWithExecOpts = {
297
295
  /**
298
- * If the container has an entrypoint, prepend it to the args.
296
+ * Apply the OCI entrypoint, if present, by prepending it to the args. Ignored by default.
299
297
  */
300
298
  useEntrypoint?: boolean;
301
299
  /**
302
- * Content to write to the command's standard input before closing (e.g., "Hello world").
300
+ * Content to write to the command's standard input. Example: "Hello world")
303
301
  */
304
302
  stdin?: string;
305
303
  /**
306
- * Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
304
+ * Redirect the command's standard output to a file in the container. Example: "./stdout.txt"
307
305
  */
308
306
  redirectStdout?: string;
309
307
  /**
310
- * Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
308
+ * Like redirectStdout, but for standard error
311
309
  */
312
310
  redirectStderr?: string;
313
311
  /**
@@ -316,12 +314,12 @@ export type ContainerWithExecOpts = {
316
314
  expect?: ReturnType;
317
315
  /**
318
316
  * Provides Dagger access to the executed command.
319
- *
320
- * 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.
321
317
  */
322
318
  experimentalPrivilegedNesting?: boolean;
323
319
  /**
324
- * 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.
320
+ * Execute the command with all root capabilities. Like --privileged in Docker
321
+ *
322
+ * 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.
325
323
  */
326
324
  insecureRootCapabilities?: boolean;
327
325
  /**
@@ -329,19 +327,19 @@ export type ContainerWithExecOpts = {
329
327
  */
330
328
  expand?: boolean;
331
329
  /**
332
- * If set, skip the automatic init process injected into containers by default.
330
+ * Skip the automatic init process injected into containers by default.
333
331
  *
334
- * 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.
332
+ * 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.
335
333
  */
336
334
  noInit?: boolean;
337
335
  };
338
336
  export type ContainerWithExposedPortOpts = {
339
337
  /**
340
- * Transport layer network protocol
338
+ * Network protocol. Example: "tcp"
341
339
  */
342
340
  protocol?: NetworkProtocol;
343
341
  /**
344
- * Optional port description
342
+ * Port description. Example: "payment API endpoint"
345
343
  */
346
344
  description?: string;
347
345
  /**
@@ -351,7 +349,7 @@ export type ContainerWithExposedPortOpts = {
351
349
  };
352
350
  export type ContainerWithFileOpts = {
353
351
  /**
354
- * Permission given to the copied file (e.g., 0600).
352
+ * Permissions of the new file. Example: 0600
355
353
  */
356
354
  permissions?: number;
357
355
  /**
@@ -469,7 +467,7 @@ export type ContainerWithMountedTempOpts = {
469
467
  };
470
468
  export type ContainerWithNewFileOpts = {
471
469
  /**
472
- * Permission given to the written file (e.g., 0600).
470
+ * Permissions of the new file. Example: 0600
473
471
  */
474
472
  permissions?: number;
475
473
  /**
@@ -608,6 +606,12 @@ export type DirectoryDockerBuildOpts = {
608
606
  * They will be mounted at /run/secrets/[secret-name].
609
607
  */
610
608
  secrets?: Secret[];
609
+ /**
610
+ * If set, skip the automatic init process injected into containers created by RUN statements.
611
+ *
612
+ * 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.
613
+ */
614
+ noInit?: boolean;
611
615
  };
612
616
  export type DirectoryEntriesOpts = {
613
617
  /**
@@ -623,11 +627,11 @@ export type DirectoryExportOpts = {
623
627
  };
624
628
  export type DirectoryFilterOpts = {
625
629
  /**
626
- * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
630
+ * If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"]
627
631
  */
628
632
  exclude?: string[];
629
633
  /**
630
- * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
634
+ * If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]).
631
635
  */
632
636
  include?: string[];
633
637
  };
@@ -638,8 +642,6 @@ export type DirectoryTerminalOpts = {
638
642
  cmd?: string[];
639
643
  /**
640
644
  * Provides Dagger access to the executed command.
641
- *
642
- * 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.
643
645
  */
644
646
  experimentalPrivilegedNesting?: boolean;
645
647
  /**
@@ -681,7 +683,7 @@ export type DirectoryWithNewDirectoryOpts = {
681
683
  };
682
684
  export type DirectoryWithNewFileOpts = {
683
685
  /**
684
- * Permission given to the copied file (e.g., 0600).
686
+ * Permissions of the new file. Example: 0600
685
687
  */
686
688
  permissions?: number;
687
689
  };
@@ -1045,7 +1047,7 @@ export type ClientCacheVolumeOpts = {
1045
1047
  };
1046
1048
  export type ClientContainerOpts = {
1047
1049
  /**
1048
- * Platform to initialize the container with.
1050
+ * Platform to initialize the container with. Defaults to the native platform of the current engine
1049
1051
  */
1050
1052
  platform?: Platform;
1051
1053
  };
@@ -1054,6 +1056,10 @@ export type ClientEnvOpts = {
1054
1056
  * Give the environment the same privileges as the caller: core API including host access, current module, and dependencies
1055
1057
  */
1056
1058
  privileged?: boolean;
1059
+ /**
1060
+ * Allow new outputs to be declared and saved in the environment
1061
+ */
1062
+ writable?: boolean;
1057
1063
  };
1058
1064
  export type ClientGitOpts = {
1059
1065
  /**
@@ -1089,9 +1095,6 @@ export type ClientLlmOpts = {
1089
1095
  */
1090
1096
  maxAPICalls?: number;
1091
1097
  };
1092
- export type ClientLoadSecretFromNameOpts = {
1093
- accessor?: string;
1094
- };
1095
1098
  export type ClientModuleSourceOpts = {
1096
1099
  /**
1097
1100
  * The pinned version of the module source
@@ -1319,13 +1322,15 @@ export type __TypeFieldsOpts = {
1319
1322
  };
1320
1323
  export declare class Binding extends BaseClient {
1321
1324
  private readonly _id?;
1325
+ private readonly _asString?;
1322
1326
  private readonly _digest?;
1327
+ private readonly _isNull?;
1323
1328
  private readonly _name?;
1324
1329
  private readonly _typeName?;
1325
1330
  /**
1326
1331
  * Constructor is used for internal usage only, do not create object from it.
1327
1332
  */
1328
- constructor(ctx?: Context, _id?: BindingID, _digest?: string, _name?: string, _typeName?: string);
1333
+ constructor(ctx?: Context, _id?: BindingID, _asString?: string, _digest?: string, _isNull?: boolean, _name?: string, _typeName?: string);
1329
1334
  /**
1330
1335
  * A unique identifier for this Binding.
1331
1336
  */
@@ -1386,10 +1391,18 @@ export declare class Binding extends BaseClient {
1386
1391
  * Retrieve the binding value, as type Socket
1387
1392
  */
1388
1393
  asSocket: () => Socket;
1394
+ /**
1395
+ * The binding's string value
1396
+ */
1397
+ asString: () => Promise<string>;
1389
1398
  /**
1390
1399
  * The digest of the binding value
1391
1400
  */
1392
1401
  digest: () => Promise<string>;
1402
+ /**
1403
+ * Returns true if the binding is null
1404
+ */
1405
+ isNull: () => Promise<boolean>;
1393
1406
  /**
1394
1407
  * The binding name
1395
1408
  */
@@ -1448,8 +1461,6 @@ export declare class Container extends BaseClient {
1448
1461
  * If empty, the container's default command is used.
1449
1462
  * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
1450
1463
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1451
- *
1452
- * 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.
1453
1464
  * @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.
1454
1465
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
1455
1466
  * @param opts.noInit If set, skip the automatic init process injected into containers by default.
@@ -1458,7 +1469,7 @@ export declare class Container extends BaseClient {
1458
1469
  */
1459
1470
  asService: (opts?: ContainerAsServiceOpts) => Service;
1460
1471
  /**
1461
- * Returns a File representing the container serialized to a tarball.
1472
+ * Package the container state as an OCI image, and return it as a tar archive
1462
1473
  * @param opts.platformVariants Identifiers for other platform specific containers.
1463
1474
  *
1464
1475
  * Used for multi-platform images.
@@ -1481,14 +1492,17 @@ export declare class Container extends BaseClient {
1481
1492
  * They will be mounted at /run/secrets/[secret-name] in the build container
1482
1493
  *
1483
1494
  * 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))
1495
+ * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements.
1496
+ *
1497
+ * 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.
1484
1498
  */
1485
1499
  build: (context: Directory, opts?: ContainerBuildOpts) => Container;
1486
1500
  /**
1487
- * Retrieves default arguments for future commands.
1501
+ * Return the container's default arguments.
1488
1502
  */
1489
1503
  defaultArgs: () => Promise<string[]>;
1490
1504
  /**
1491
- * Retrieves a directory at the given path.
1505
+ * Retrieve a directory from the container's root filesystem
1492
1506
  *
1493
1507
  * Mounts are included.
1494
1508
  * @param path The path of the directory to retrieve (e.g., "./src").
@@ -1496,7 +1510,7 @@ export declare class Container extends BaseClient {
1496
1510
  */
1497
1511
  directory: (path: string, opts?: ContainerDirectoryOpts) => Directory;
1498
1512
  /**
1499
- * Retrieves entrypoint to be prepended to the arguments of all commands.
1513
+ * Return the container's OCI entrypoint.
1500
1514
  */
1501
1515
  entrypoint: () => Promise<string[]>;
1502
1516
  /**
@@ -1509,9 +1523,9 @@ export declare class Container extends BaseClient {
1509
1523
  */
1510
1524
  envVariables: () => Promise<EnvVariable[]>;
1511
1525
  /**
1512
- * The exit code of the last executed command.
1526
+ * The exit code of the last executed command
1513
1527
  *
1514
- * Returns an error if no command was set.
1528
+ * Returns an error if no command was executed
1515
1529
  */
1516
1530
  exitCode: () => Promise<number>;
1517
1531
  /**
@@ -1565,10 +1579,8 @@ export declare class Container extends BaseClient {
1565
1579
  */
1566
1580
  file: (path: string, opts?: ContainerFileOpts) => File;
1567
1581
  /**
1568
- * Initializes this container from a pulled base image.
1569
- * @param address Image's address from its registry.
1570
- *
1571
- * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
1582
+ * Download a container image, and apply it to the container state. All previous state will be lost.
1583
+ * @param address Address of the container image to download, in standard OCI ref format. Example:"registry.dagger.io/engine:latest"
1572
1584
  */
1573
1585
  from: (address: string) => Container;
1574
1586
  /**
@@ -1599,14 +1611,12 @@ export declare class Container extends BaseClient {
1599
1611
  */
1600
1612
  platform: () => Promise<Platform>;
1601
1613
  /**
1602
- * Publishes this container as a new image to the specified address.
1603
- *
1604
- * Publish returns a fully qualified ref.
1614
+ * Package the container state as an OCI image, and publish it to a registry
1605
1615
  *
1606
- * It can also publish platform variants.
1607
- * @param address Registry's address to publish the image to.
1616
+ * Returns the fully qualified address of the published image, with digest
1617
+ * @param address The OCI address to publish to
1608
1618
  *
1609
- * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
1619
+ * Same format as "docker push". Example: "registry.example.com/user/repo:tag"
1610
1620
  * @param opts.platformVariants Identifiers for other platform specific containers.
1611
1621
  *
1612
1622
  * Used for multi-platform image.
@@ -1615,23 +1625,23 @@ export declare class Container extends BaseClient {
1615
1625
  * 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.
1616
1626
  * @param opts.mediaTypes Use the specified media types for the published image's layers.
1617
1627
  *
1618
- * Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
1628
+ * Defaults to "OCI", which is compatible with most recent registries, but "Docker" may be needed for older registries without OCI support.
1619
1629
  */
1620
1630
  publish: (address: string, opts?: ContainerPublishOpts) => Promise<string>;
1621
1631
  /**
1622
- * Retrieves this container's root filesystem. Mounts are not included.
1632
+ * 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.
1623
1633
  */
1624
1634
  rootfs: () => Directory;
1625
1635
  /**
1626
- * The error stream of the last executed command.
1636
+ * The buffered standard error stream of the last executed command
1627
1637
  *
1628
- * Returns an error if no command was set.
1638
+ * Returns an error if no command was executed
1629
1639
  */
1630
1640
  stderr: () => Promise<string>;
1631
1641
  /**
1632
- * The output stream of the last executed command.
1642
+ * The buffered standard output stream of the last executed command
1633
1643
  *
1634
- * Returns an error if no command was set.
1644
+ * Returns an error if no command was executed
1635
1645
  */
1636
1646
  stdout: () => Promise<string>;
1637
1647
  /**
@@ -1644,8 +1654,6 @@ export declare class Container extends BaseClient {
1644
1654
  * Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default).
1645
1655
  * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead.
1646
1656
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1647
- *
1648
- * 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.
1649
1657
  * @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.
1650
1658
  */
1651
1659
  terminal: (opts?: ContainerTerminalOpts) => Container;
@@ -1662,8 +1670,6 @@ export declare class Container extends BaseClient {
1662
1670
  * If empty, the container's default command is used.
1663
1671
  * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
1664
1672
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1665
- *
1666
- * 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.
1667
1673
  * @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.
1668
1674
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
1669
1675
  * @param opts.noInit If set, skip the automatic init process injected into containers by default.
@@ -1682,7 +1688,7 @@ export declare class Container extends BaseClient {
1682
1688
  */
1683
1689
  withAnnotation: (name: string, value: string) => Container;
1684
1690
  /**
1685
- * Configures default arguments for future commands.
1691
+ * Configures default arguments for future commands. Like CMD in Dockerfile.
1686
1692
  * @param args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
1687
1693
  */
1688
1694
  withDefaultArgs: (args: string[]) => Container;
@@ -1690,13 +1696,11 @@ export declare class Container extends BaseClient {
1690
1696
  * Set the default command to invoke for the container's terminal API.
1691
1697
  * @param args The args of the command.
1692
1698
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1693
- *
1694
- * 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.
1695
1699
  * @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.
1696
1700
  */
1697
1701
  withDefaultTerminalCmd: (args: string[], opts?: ContainerWithDefaultTerminalCmdOpts) => Container;
1698
1702
  /**
1699
- * Retrieves this container plus a directory written at the given path.
1703
+ * Return a new container snapshot, with a directory added to its filesystem
1700
1704
  * @param path Location of the written directory (e.g., "/tmp/directory").
1701
1705
  * @param directory Identifier of the directory to write
1702
1706
  * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
@@ -1710,57 +1714,59 @@ export declare class Container extends BaseClient {
1710
1714
  */
1711
1715
  withDirectory: (path: string, directory: Directory, opts?: ContainerWithDirectoryOpts) => Container;
1712
1716
  /**
1713
- * Retrieves this container but with a different command entrypoint.
1714
- * @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
1715
- * @param opts.keepDefaultArgs Don't remove the default arguments when setting the entrypoint.
1717
+ * Set an OCI-style entrypoint. It will be included in the container's OCI configuration. Note, withExec ignores the entrypoint by default.
1718
+ * @param args Arguments of the entrypoint. Example: ["go", "run"].
1719
+ * @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.
1716
1720
  */
1717
1721
  withEntrypoint: (args: string[], opts?: ContainerWithEntrypointOpts) => Container;
1718
1722
  /**
1719
- * Retrieves this container plus the given environment variable.
1720
- * @param name The name of the environment variable (e.g., "HOST").
1721
- * @param value The value of the environment variable. (e.g., "localhost").
1723
+ * Set a new environment variable in the container.
1724
+ * @param name Name of the environment variable (e.g., "HOST").
1725
+ * @param value Value of the environment variable. (e.g., "localhost").
1722
1726
  * @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").
1723
1727
  */
1724
1728
  withEnvVariable: (name: string, value: string, opts?: ContainerWithEnvVariableOpts) => Container;
1725
1729
  /**
1726
- * Retrieves this container after executing the specified command inside it.
1727
- * @param args Command to run instead of the container's default command (e.g., ["go", "run", "main.go"]).
1730
+ * Execute a command in the container, and return a new snapshot of the container state after execution.
1731
+ * @param args Command to execute. Must be valid exec() arguments, not a shell command. Example: ["go", "run", "main.go"].
1728
1732
  *
1729
- * If empty, the container's default command is used.
1730
- * @param opts.useEntrypoint If the container has an entrypoint, prepend it to the args.
1731
- * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
1732
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
1733
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
1733
+ * To run a shell command, execute the shell and pass the shell command as argument. Example: ["sh", "-c", "ls -l | grep foo"]
1734
+ *
1735
+ * Defaults to the container's default arguments (see "defaultArgs" and "withDefaultArgs").
1736
+ * @param opts.useEntrypoint Apply the OCI entrypoint, if present, by prepending it to the args. Ignored by default.
1737
+ * @param opts.stdin Content to write to the command's standard input. Example: "Hello world")
1738
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container. Example: "./stdout.txt"
1739
+ * @param opts.redirectStderr Like redirectStdout, but for standard error
1734
1740
  * @param opts.expect Exit codes this command is allowed to exit with without error
1735
1741
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
1742
+ * @param opts.insecureRootCapabilities Execute the command with all root capabilities. Like --privileged in Docker
1736
1743
  *
1737
- * 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.
1738
- * @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.
1744
+ * 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.
1739
1745
  * @param opts.expand Replace "${VAR}" or "$VAR" in the args according to the current environment variables defined in the container (e.g. "/$VAR/foo").
1740
- * @param opts.noInit If set, skip the automatic init process injected into containers by default.
1746
+ * @param opts.noInit Skip the automatic init process injected into containers by default.
1741
1747
  *
1742
- * 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.
1748
+ * 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.
1743
1749
  */
1744
1750
  withExec: (args: string[], opts?: ContainerWithExecOpts) => Container;
1745
1751
  /**
1746
- * Expose a network port.
1752
+ * Expose a network port. Like EXPOSE in Dockerfile (but with healthcheck support)
1747
1753
  *
1748
1754
  * Exposed ports serve two purposes:
1749
1755
  *
1750
1756
  * - For health checks and introspection, when running services
1751
1757
  *
1752
1758
  * - For setting the EXPOSE OCI field when publishing the container
1753
- * @param port Port number to expose
1754
- * @param opts.protocol Transport layer network protocol
1755
- * @param opts.description Optional port description
1759
+ * @param port Port number to expose. Example: 8080
1760
+ * @param opts.protocol Network protocol. Example: "tcp"
1761
+ * @param opts.description Port description. Example: "payment API endpoint"
1756
1762
  * @param opts.experimentalSkipHealthcheck Skip the health check when run as a service.
1757
1763
  */
1758
1764
  withExposedPort: (port: number, opts?: ContainerWithExposedPortOpts) => Container;
1759
1765
  /**
1760
- * Retrieves this container plus the contents of the given file copied to the given path.
1761
- * @param path Location of the copied file (e.g., "/tmp/file.txt").
1762
- * @param source Identifier of the file to copy.
1763
- * @param opts.permissions Permission given to the copied file (e.g., 0600).
1766
+ * Return a container snapshot with a file added
1767
+ * @param path Path of the new file. Example: "/path/to/new-file.txt"
1768
+ * @param source File to add
1769
+ * @param opts.permissions Permissions of the new file. Example: 0600
1764
1770
  * @param opts.owner A user:group to set for the file.
1765
1771
  *
1766
1772
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1851,10 +1857,10 @@ export declare class Container extends BaseClient {
1851
1857
  */
1852
1858
  withMountedTemp: (path: string, opts?: ContainerWithMountedTempOpts) => Container;
1853
1859
  /**
1854
- * Retrieves this container plus a new file written at the given path.
1855
- * @param path Location of the written file (e.g., "/tmp/file.txt").
1856
- * @param contents Content of the file to write (e.g., "Hello world!").
1857
- * @param opts.permissions Permission given to the written file (e.g., 0600).
1860
+ * Return a new container snapshot, with a file added to its filesystem with text content
1861
+ * @param path Path of the new file. May be relative or absolute. Example: "README.md" or "/etc/profile"
1862
+ * @param contents Contents of the new file. Example: "Hello world!"
1863
+ * @param opts.permissions Permissions of the new file. Example: 0600
1858
1864
  * @param opts.owner A user:group to set for the file.
1859
1865
  *
1860
1866
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1864,35 +1870,33 @@ export declare class Container extends BaseClient {
1864
1870
  */
1865
1871
  withNewFile: (path: string, contents: string, opts?: ContainerWithNewFileOpts) => Container;
1866
1872
  /**
1867
- * Retrieves this container with a registry authentication for a given address.
1868
- * @param address Registry's address to bind the authentication to.
1869
- *
1870
- * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1871
- * @param username The username of the registry's account (e.g., "Dagger").
1872
- * @param secret The API key, password or token to authenticate to this registry.
1873
+ * Attach credentials for future publishing to a registry. Use in combination with publish
1874
+ * @param address The image address that needs authentication. Same format as "docker push". Example: "registry.dagger.io/dagger:latest"
1875
+ * @param username The username to authenticate with. Example: "alice"
1876
+ * @param secret The API key, password or token to authenticate to this registry
1873
1877
  */
1874
1878
  withRegistryAuth: (address: string, username: string, secret: Secret) => Container;
1875
1879
  /**
1876
- * Retrieves the container with the given directory mounted to /.
1877
- * @param directory Directory to mount.
1880
+ * Change the container's root filesystem. The previous root filesystem will be lost.
1881
+ * @param directory The new root filesystem.
1878
1882
  */
1879
1883
  withRootfs: (directory: Directory) => Container;
1880
1884
  /**
1881
- * Retrieves this container plus an env variable containing the given secret.
1882
- * @param name The name of the secret variable (e.g., "API_SECRET").
1883
- * @param secret The identifier of the secret value.
1885
+ * Set a new environment variable, using a secret value
1886
+ * @param name Name of the secret variable (e.g., "API_SECRET").
1887
+ * @param secret Identifier of the secret value.
1884
1888
  */
1885
1889
  withSecretVariable: (name: string, secret: Secret) => Container;
1886
1890
  /**
1887
- * Establish a runtime dependency on a service.
1891
+ * Establish a runtime dependency on a from a container to a network service.
1888
1892
  *
1889
1893
  * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set.
1890
1894
  *
1891
1895
  * The service will be reachable from the container via the provided hostname alias.
1892
1896
  *
1893
1897
  * The service dependency will also convey to any files or directories produced by the container.
1894
- * @param alias A name that can be used to reach the service from the container
1895
- * @param service Identifier of the service container
1898
+ * @param alias Hostname that will resolve to the target service (only accessible from within this container)
1899
+ * @param service The target service
1896
1900
  */
1897
1901
  withServiceBinding: (alias: string, service: Service) => Container;
1898
1902
  /**
@@ -1913,7 +1917,7 @@ export declare class Container extends BaseClient {
1913
1917
  */
1914
1918
  withUser: (name: string) => Container;
1915
1919
  /**
1916
- * Retrieves this container with a different working directory.
1920
+ * Change the container's working directory. Like WORKDIR in Dockerfile.
1917
1921
  * @param path The path to set as the working directory (e.g., "/app").
1918
1922
  * @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").
1919
1923
  */
@@ -1924,17 +1928,17 @@ export declare class Container extends BaseClient {
1924
1928
  */
1925
1929
  withoutAnnotation: (name: string) => Container;
1926
1930
  /**
1927
- * Retrieves this container with unset default arguments for future commands.
1931
+ * Remove the container's default arguments.
1928
1932
  */
1929
1933
  withoutDefaultArgs: () => Container;
1930
1934
  /**
1931
- * Retrieves this container with the directory at the given path removed.
1935
+ * Return a new container snapshot, with a directory removed from its filesystem
1932
1936
  * @param path Location of the directory to remove (e.g., ".github/").
1933
1937
  * @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").
1934
1938
  */
1935
1939
  withoutDirectory: (path: string, opts?: ContainerWithoutDirectoryOpts) => Container;
1936
1940
  /**
1937
- * Retrieves this container with an unset command entrypoint.
1941
+ * Reset the container's OCI entrypoint.
1938
1942
  * @param opts.keepDefaultArgs Don't remove the default arguments when unsetting the entrypoint.
1939
1943
  */
1940
1944
  withoutEntrypoint: (opts?: ContainerWithoutEntrypointOpts) => Container;
@@ -1956,8 +1960,8 @@ export declare class Container extends BaseClient {
1956
1960
  */
1957
1961
  withoutFile: (path: string, opts?: ContainerWithoutFileOpts) => Container;
1958
1962
  /**
1959
- * Retrieves this container with the files at the given paths removed.
1960
- * @param paths Location of the files to remove (e.g., ["/file.txt"]).
1963
+ * Return a new container spanshot with specified files removed
1964
+ * @param paths Paths of the files to remove. Example: ["foo.txt, "/root/.ssh/config"
1961
1965
  * @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").
1962
1966
  */
1963
1967
  withoutFiles: (paths: string[], opts?: ContainerWithoutFilesOpts) => Container;
@@ -1997,7 +2001,7 @@ export declare class Container extends BaseClient {
1997
2001
  */
1998
2002
  withoutUser: () => Container;
1999
2003
  /**
2000
- * Retrieves this container with an unset working directory.
2004
+ * Unset the container's working directory.
2001
2005
  *
2002
2006
  * Should default to "/".
2003
2007
  */
@@ -2066,7 +2070,7 @@ export declare class Directory extends BaseClient {
2066
2070
  */
2067
2071
  id: () => Promise<DirectoryID>;
2068
2072
  /**
2069
- * Converts this directory into a git repository
2073
+ * Converts this directory to a local git repository
2070
2074
  */
2071
2075
  asGit: () => GitRepository;
2072
2076
  /**
@@ -2084,8 +2088,8 @@ export declare class Directory extends BaseClient {
2084
2088
  */
2085
2089
  asModuleSource: (opts?: DirectoryAsModuleSourceOpts) => ModuleSource;
2086
2090
  /**
2087
- * Gets the difference between this directory and an another directory.
2088
- * @param other Identifier of the directory to compare.
2091
+ * Return the difference between this directory and an another directory. The difference is encoded as a directory.
2092
+ * @param other The directory to compare against
2089
2093
  */
2090
2094
  diff: (other: Directory) => Directory;
2091
2095
  /**
@@ -2094,11 +2098,11 @@ export declare class Directory extends BaseClient {
2094
2098
  digest: () => Promise<string>;
2095
2099
  /**
2096
2100
  * Retrieves a directory at the given path.
2097
- * @param path Location of the directory to retrieve (e.g., "/src").
2101
+ * @param path Location of the directory to retrieve. Example: "/src"
2098
2102
  */
2099
2103
  directory: (path: string) => Directory;
2100
2104
  /**
2101
- * Builds a new Docker container from this directory.
2105
+ * 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.
2102
2106
  * @param opts.platform The platform to build.
2103
2107
  * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
2104
2108
  * @param opts.target Target build stage to build.
@@ -2106,6 +2110,9 @@ export declare class Directory extends BaseClient {
2106
2110
  * @param opts.secrets Secrets to pass to the build.
2107
2111
  *
2108
2112
  * They will be mounted at /run/secrets/[secret-name].
2113
+ * @param opts.noInit If set, skip the automatic init process injected into containers created by RUN statements.
2114
+ *
2115
+ * 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.
2109
2116
  */
2110
2117
  dockerBuild: (opts?: DirectoryDockerBuildOpts) => Container;
2111
2118
  /**
@@ -2120,14 +2127,14 @@ export declare class Directory extends BaseClient {
2120
2127
  */
2121
2128
  export: (path: string, opts?: DirectoryExportOpts) => Promise<string>;
2122
2129
  /**
2123
- * Retrieves a file at the given path.
2130
+ * Retrieve a file at the given path.
2124
2131
  * @param path Location of the file to retrieve (e.g., "README.md").
2125
2132
  */
2126
2133
  file: (path: string) => File;
2127
2134
  /**
2128
- * Retrieves this directory as per exclude/include filters.
2129
- * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
2130
- * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
2135
+ * Return a snapshot with some paths included or excluded
2136
+ * @param opts.exclude If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"]
2137
+ * @param opts.include If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]).
2131
2138
  */
2132
2139
  filter: (opts?: DirectoryFilterOpts) => Directory;
2133
2140
  /**
@@ -2147,14 +2154,12 @@ export declare class Directory extends BaseClient {
2147
2154
  * Opens an interactive terminal in new container with this directory mounted inside.
2148
2155
  * @param opts.cmd If set, override the container's default terminal command and invoke these command arguments instead.
2149
2156
  * @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
2150
- *
2151
- * 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.
2152
2157
  * @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.
2153
2158
  * @param opts.container If set, override the default container used for the terminal.
2154
2159
  */
2155
2160
  terminal: (opts?: DirectoryTerminalOpts) => Directory;
2156
2161
  /**
2157
- * Retrieves this directory plus a directory written at the given path.
2162
+ * Return a snapshot with a directory added
2158
2163
  * @param path Location of the written directory (e.g., "/src/").
2159
2164
  * @param directory Identifier of the directory to copy.
2160
2165
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
@@ -2182,10 +2187,10 @@ export declare class Directory extends BaseClient {
2182
2187
  */
2183
2188
  withNewDirectory: (path: string, opts?: DirectoryWithNewDirectoryOpts) => Directory;
2184
2189
  /**
2185
- * Retrieves this directory plus a new file written at the given path.
2186
- * @param path Location of the written file (e.g., "/file.txt").
2187
- * @param contents Content of the written file (e.g., "Hello world!").
2188
- * @param opts.permissions Permission given to the copied file (e.g., 0600).
2190
+ * Return a snapshot with a new file added
2191
+ * @param path Path of the new file. Example: "foo/bar.txt"
2192
+ * @param contents Contents of the new file. Example: "Hello world!"
2193
+ * @param opts.permissions Permissions of the new file. Example: 0600
2189
2194
  */
2190
2195
  withNewFile: (path: string, contents: string, opts?: DirectoryWithNewFileOpts) => Directory;
2191
2196
  /**
@@ -2196,18 +2201,18 @@ export declare class Directory extends BaseClient {
2196
2201
  */
2197
2202
  withTimestamps: (timestamp: number) => Directory;
2198
2203
  /**
2199
- * Retrieves this directory with the directory at the given path removed.
2200
- * @param path Location of the directory to remove (e.g., ".github/").
2204
+ * Return a snapshot with a subdirectory removed
2205
+ * @param path Path of the subdirectory to remove. Example: ".github/workflows"
2201
2206
  */
2202
2207
  withoutDirectory: (path: string) => Directory;
2203
2208
  /**
2204
- * Retrieves this directory with the file at the given path removed.
2205
- * @param path Location of the file to remove (e.g., "/file.txt").
2209
+ * Return a snapshot with a file removed
2210
+ * @param path Path of the file to remove (e.g., "/file.txt").
2206
2211
  */
2207
2212
  withoutFile: (path: string) => Directory;
2208
2213
  /**
2209
- * Retrieves this directory with the files at the given paths removed.
2210
- * @param paths Location of the file to remove (e.g., ["/file.txt"]).
2214
+ * Return a snapshot with files removed
2215
+ * @param paths Paths of the files to remove (e.g., ["/file.txt"]).
2211
2216
  */
2212
2217
  withoutFiles: (paths: string[]) => Directory;
2213
2218
  /**
@@ -2620,8 +2625,15 @@ export declare class Env extends BaseClient {
2620
2625
  * Create or update an input value of type string
2621
2626
  * @param name The name of the binding
2622
2627
  * @param value The string value to assign to the binding
2628
+ * @param description The description of the input
2623
2629
  */
2624
2630
  withStringInput: (name: string, value: string, description: string) => Env;
2631
+ /**
2632
+ * Create or update an input value of type string
2633
+ * @param name The name of the binding
2634
+ * @param description The description of the output
2635
+ */
2636
+ withStringOutput: (name: string, description: string) => Env;
2625
2637
  /**
2626
2638
  * Call the provided function with current Env.
2627
2639
  *
@@ -3150,6 +3162,7 @@ export declare class Host extends BaseClient {
3150
3162
  * The file is limited to a size of 512000 bytes.
3151
3163
  * @param name The user defined name for this secret.
3152
3164
  * @param path Location of the file to set as a secret.
3165
+ * @deprecated setSecretFile is superceded by use of the secret API with file:// URIs
3153
3166
  */
3154
3167
  setSecretFile: (name: string, path: string) => Secret;
3155
3168
  /**
@@ -3247,7 +3260,7 @@ export declare class LLM extends BaseClient {
3247
3260
  /**
3248
3261
  * Constructor is used for internal usage only, do not create object from it.
3249
3262
  */
3250
- constructor(ctx?: Context, _id?: LLMID, _historyJSON?: string, _lastReply?: string, _model?: string, _provider?: string, _sync?: LLMID, _tools?: string);
3263
+ constructor(ctx?: Context, _id?: LLMID, _historyJSON?: JSON, _lastReply?: string, _model?: string, _provider?: string, _sync?: LLMID, _tools?: string);
3251
3264
  /**
3252
3265
  * A unique identifier for this LLM.
3253
3266
  */
@@ -3271,7 +3284,7 @@ export declare class LLM extends BaseClient {
3271
3284
  /**
3272
3285
  * return the raw llm message history as json
3273
3286
  */
3274
- historyJSON: () => Promise<string>;
3287
+ historyJSON: () => Promise<JSON>;
3275
3288
  /**
3276
3289
  * return the last llm reply from the history
3277
3290
  */
@@ -3324,6 +3337,10 @@ export declare class LLM extends BaseClient {
3324
3337
  * @param prompt The system prompt to send
3325
3338
  */
3326
3339
  withSystemPrompt: (prompt: string) => LLM;
3340
+ /**
3341
+ * Disable the default system prompt
3342
+ */
3343
+ withoutDefaultSystemPrompt: () => LLM;
3327
3344
  /**
3328
3345
  * Call the provided function with current LLM.
3329
3346
  *
@@ -3689,6 +3706,11 @@ export declare class ModuleSource extends BaseClient {
3689
3706
  * @param dependencies The dependencies to update.
3690
3707
  */
3691
3708
  withUpdateDependencies: (dependencies: string[]) => ModuleSource;
3709
+ /**
3710
+ * Remove a client from the module source.
3711
+ * @param path The path of the client to remove.
3712
+ */
3713
+ withoutClient: (path: string) => ModuleSource;
3692
3714
  /**
3693
3715
  * Remove the provided dependencies from the module source's dependency list.
3694
3716
  * @param dependencies The dependencies to remove.
@@ -3800,10 +3822,10 @@ export declare class Client extends BaseClient {
3800
3822
  */
3801
3823
  cacheVolume: (key: string, opts?: ClientCacheVolumeOpts) => CacheVolume;
3802
3824
  /**
3803
- * Creates a scratch container.
3825
+ * Creates a scratch container, with no image or metadata.
3804
3826
  *
3805
- * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
3806
- * @param opts.platform Platform to initialize the container with.
3827
+ * To pull an image, follow up with the "from" function.
3828
+ * @param opts.platform Platform to initialize the container with. Defaults to the native platform of the current engine
3807
3829
  */
3808
3830
  container: (opts?: ClientContainerOpts) => Container;
3809
3831
  /**
@@ -3835,6 +3857,8 @@ export declare class Client extends BaseClient {
3835
3857
  /**
3836
3858
  * Initialize a new environment
3837
3859
  * @param opts.privileged Give the environment the same privileges as the caller: core API including host access, current module, and dependencies
3860
+ * @param opts.writable Allow new outputs to be declared and saved in the environment
3861
+ * @experimental
3838
3862
  */
3839
3863
  env: (opts?: ClientEnvOpts) => Env;
3840
3864
  /**
@@ -3879,6 +3903,7 @@ export declare class Client extends BaseClient {
3879
3903
  * Initialize a Large Language Model (LLM)
3880
3904
  * @param opts.model Model to use
3881
3905
  * @param opts.maxAPICalls Cap the number of API calls for this LLM
3906
+ * @experimental
3882
3907
  */
3883
3908
  llm: (opts?: ClientLlmOpts) => LLM;
3884
3909
  /**
@@ -4037,10 +4062,6 @@ export declare class Client extends BaseClient {
4037
4062
  * Load a Secret from its ID.
4038
4063
  */
4039
4064
  loadSecretFromID: (id: SecretID) => Secret;
4040
- /**
4041
- * Load a Secret from its Name.
4042
- */
4043
- loadSecretFromName: (name: string, opts?: ClientLoadSecretFromNameOpts) => Secret;
4044
4065
  /**
4045
4066
  * Load a Service from its ID.
4046
4067
  */