dataiku-sdk 0.8.0 → 0.10.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.
Files changed (41) hide show
  1. package/README.md +5 -4
  2. package/dist/src/cli.js +1668 -32
  3. package/dist/src/client.d.ts +61 -2
  4. package/dist/src/client.js +184 -5
  5. package/dist/src/index.d.ts +14 -1
  6. package/dist/src/index.js +13 -0
  7. package/dist/src/resources/api-deployer.d.ts +66 -0
  8. package/dist/src/resources/api-deployer.js +79 -0
  9. package/dist/src/resources/api-services.d.ts +38 -0
  10. package/dist/src/resources/api-services.js +50 -0
  11. package/dist/src/resources/applications.d.ts +56 -0
  12. package/dist/src/resources/applications.js +67 -0
  13. package/dist/src/resources/bundles.d.ts +53 -0
  14. package/dist/src/resources/bundles.js +103 -0
  15. package/dist/src/resources/continuous-activities.d.ts +27 -0
  16. package/dist/src/resources/continuous-activities.js +22 -0
  17. package/dist/src/resources/datasets.d.ts +6 -0
  18. package/dist/src/resources/datasets.js +15 -0
  19. package/dist/src/resources/discussions.d.ts +26 -0
  20. package/dist/src/resources/discussions.js +29 -0
  21. package/dist/src/resources/meanings.d.ts +41 -0
  22. package/dist/src/resources/meanings.js +33 -0
  23. package/dist/src/resources/metrics.d.ts +44 -0
  24. package/dist/src/resources/metrics.js +31 -0
  25. package/dist/src/resources/project-library.d.ts +38 -0
  26. package/dist/src/resources/project-library.js +82 -0
  27. package/dist/src/resources/projects.d.ts +70 -0
  28. package/dist/src/resources/projects.js +97 -0
  29. package/dist/src/resources/recipes.js +10 -8
  30. package/dist/src/resources/scenarios.d.ts +3 -0
  31. package/dist/src/resources/scenarios.js +8 -1
  32. package/dist/src/resources/statistics.d.ts +56 -0
  33. package/dist/src/resources/statistics.js +51 -0
  34. package/dist/src/resources/streaming-endpoints.d.ts +45 -0
  35. package/dist/src/resources/streaming-endpoints.js +36 -0
  36. package/dist/src/resources/webapps.d.ts +27 -0
  37. package/dist/src/resources/webapps.js +36 -0
  38. package/dist/src/resources/workspaces.d.ts +59 -0
  39. package/dist/src/resources/workspaces.js +31 -0
  40. package/dist/src/skill.js +6 -4
  41. package/package.json +1 -1
package/dist/src/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createHash, } from "node:crypto";
3
- import { readFileSync, } from "node:fs";
3
+ import { readFileSync, writeFileSync, } from "node:fs";
4
4
  import { mkdir, writeFile, } from "node:fs/promises";
5
5
  import { dirname, join, resolve, } from "node:path";
6
6
  import { fileURLToPath, } from "node:url";
@@ -72,6 +72,9 @@ function gitRevision(packageRoot) {
72
72
  const PACKAGE_ROOT = findPackageRoot();
73
73
  const CLI_VERSION = packageVersion(PACKAGE_ROOT);
74
74
  const CLI_GIT_REVISION = gitRevision(PACKAGE_ROOT);
75
+ const AGENT_CONTRACT_VERSION = 1;
76
+ const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
77
+ const AGENT_CONTRACT_SCHEMA_ID = "https://clssck.github.io/dataiku-sdk/schemas/agent-contract-v1.json";
75
78
  function cliVersionResult() {
76
79
  return { version: CLI_VERSION, gitRevision: CLI_GIT_REVISION ?? null, };
77
80
  }
@@ -1064,7 +1067,7 @@ function resolveSqlInput(args, flags) {
1064
1067
  }
1065
1068
  return query;
1066
1069
  }
1067
- const CODE_RUN_USAGE = "dss code run (--file PATH | --stdin) [--env ENV] [--timeout MS] [--keep] [--full-log] [--project-key KEY]";
1070
+ const CODE_RUN_USAGE = "dss code run (--file PATH | --stdin) [--env ENV] [--timeout MS] [--keep] [--full-log] [--max-log-bytes N] [--project-key KEY]";
1068
1071
  function resolveCodeInput(args, flags) {
1069
1072
  if (args.length > 0) {
1070
1073
  throw new UsageError(`code run takes no positional arguments; pass the script via --file PATH or --stdin. Usage: ${CODE_RUN_USAGE}`);
@@ -1128,13 +1131,13 @@ let pendingCliWarnings = [];
1128
1131
  function enqueueCliWarning(warning) {
1129
1132
  pendingCliWarnings.push(warning);
1130
1133
  }
1131
- /** Emit queued warnings as a single `{ warnings: [...] }` object on stderr. Idempotent. */
1134
+ /** Emit queued warnings as one JSONL warning event on stderr. Idempotent. */
1132
1135
  function flushCliWarnings() {
1133
1136
  if (pendingCliWarnings.length === 0)
1134
1137
  return;
1135
1138
  const warnings = pendingCliWarnings;
1136
1139
  pendingCliWarnings = [];
1137
- process.stderr.write(`${JSON.stringify({ warnings, }, null, 2)}\n`);
1140
+ process.stderr.write(`${JSON.stringify({ type: "warning", warnings, })}\n`);
1138
1141
  }
1139
1142
  function resolveFieldPath(source, field) {
1140
1143
  let current = source;
@@ -1499,6 +1502,7 @@ const BOOLEAN_FLAGS = new Set([
1499
1502
  "errors-only",
1500
1503
  "keep",
1501
1504
  "full-log",
1505
+ "drop-data",
1502
1506
  ]);
1503
1507
  const SHORT_FLAGS = {
1504
1508
  v: "verbose",
@@ -1517,6 +1521,12 @@ const FLAG_ALIASES = {
1517
1521
  };
1518
1522
  const VALUE_FLAGS = new Set([
1519
1523
  "fields",
1524
+ "owner",
1525
+ "topic",
1526
+ "reply",
1527
+ "text",
1528
+ "partitions",
1529
+ "since",
1520
1530
  "activity",
1521
1531
  "agent",
1522
1532
  "api-key",
@@ -1554,6 +1564,7 @@ const VALUE_FLAGS = new Set([
1554
1564
  "max-edges",
1555
1565
  "max-lines",
1556
1566
  "max-log-lines",
1567
+ "max-log-bytes",
1557
1568
  "listed",
1558
1569
  "max-nodes",
1559
1570
  "max-rows",
@@ -1748,6 +1759,1227 @@ const commands = {
1748
1759
  "dss project map --include-raw",
1749
1760
  ],
1750
1761
  },
1762
+ create: {
1763
+ handler: (c, a, f) => {
1764
+ requireArgs(a, 2, "dss project create <projectKey> <name> [--owner LOGIN] [--data JSON|--data-file PATH|--stdin]");
1765
+ return c.projects.createProject(a[0], a[1], f["owner"], jsonInput(f));
1766
+ },
1767
+ usage: "dss project create <projectKey> <name> [--owner LOGIN] [--data JSON|--data-file PATH|--stdin]",
1768
+ description: "Create a new project (optionally with owner login and settings).",
1769
+ examples: ["dss project create MY_PROJ MyProject",],
1770
+ },
1771
+ delete: {
1772
+ handler: async (c, a, f) => {
1773
+ requireArgs(a, 1, "dss project delete <projectKey> [--drop-data]");
1774
+ await c.projects.deleteProject(a[0], f["drop-data"] === true);
1775
+ return { deleted: a[0], };
1776
+ },
1777
+ usage: "dss project delete <projectKey> [--drop-data]",
1778
+ description: "Delete a project (destructive). --drop-data also clears managed datasets.",
1779
+ examples: ["dss project delete MY_PROJ",],
1780
+ },
1781
+ duplicate: {
1782
+ handler: (c, a, f) => {
1783
+ requireArgs(a, 3, "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]");
1784
+ return c.projects.duplicate(a[0], a[1], a[2], jsonInput(f));
1785
+ },
1786
+ usage: "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]",
1787
+ description: "Duplicate a project into a new project key.",
1788
+ examples: ["dss project duplicate SRC NEW NewProject",],
1789
+ },
1790
+ export: {
1791
+ handler: async (c, a, f) => {
1792
+ requireArgs(a, 1, "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]");
1793
+ const out = f["output"];
1794
+ if (!out)
1795
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
1796
+ await c.projects.exportArchive(a[0], out, jsonInput(f));
1797
+ return { path: out, };
1798
+ },
1799
+ usage: "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]",
1800
+ description: "Export a project to a local archive (.zip).",
1801
+ examples: ["dss project export MY_PROJ --output ./my_proj.zip",],
1802
+ },
1803
+ import: {
1804
+ handler: async (c, a) => {
1805
+ requireArgs(a, 1, "dss project import <filePath>");
1806
+ return c.projects.importProjectFromArchive(a[0]);
1807
+ },
1808
+ usage: "dss project import <filePath>",
1809
+ description: "Upload a project archive to prepare an import (returns a temporary import id).",
1810
+ examples: ["dss project import ./my_proj.zip",],
1811
+ },
1812
+ "permissions-get": {
1813
+ handler: (c, _a, f) => c.projects.getPermissions(f["project-key"]),
1814
+ usage: "dss project permissions-get [--project-key KEY]",
1815
+ description: "Get a project's permissions.",
1816
+ examples: ["dss project permissions-get --project-key MY_PROJ",],
1817
+ },
1818
+ "permissions-set": {
1819
+ handler: async (c, _a, f) => {
1820
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (permissions object).");
1821
+ await c.projects.setPermissions(f["project-key"], body);
1822
+ return { updated: true, };
1823
+ },
1824
+ usage: "dss project permissions-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1825
+ description: "Replace a project's permissions.",
1826
+ examples: ["dss project permissions-set --data-file perms.json --project-key MY_PROJ",],
1827
+ },
1828
+ "settings-get": {
1829
+ handler: (c, _a, f) => c.projects.getSettings(f["project-key"]),
1830
+ usage: "dss project settings-get [--project-key KEY]",
1831
+ description: "Get a project's settings.",
1832
+ examples: ["dss project settings-get --project-key MY_PROJ",],
1833
+ },
1834
+ "settings-set": {
1835
+ handler: async (c, _a, f) => {
1836
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings object).");
1837
+ await c.projects.setSettings(f["project-key"], body);
1838
+ return { updated: true, };
1839
+ },
1840
+ usage: "dss project settings-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1841
+ description: "Replace a project's settings.",
1842
+ examples: ["dss project settings-set --data-file settings.json --project-key MY_PROJ",],
1843
+ },
1844
+ },
1845
+ app: {
1846
+ list: {
1847
+ handler: (c) => c.applications.listApps(),
1848
+ usage: "dss app list",
1849
+ description: "List all Dataiku App templates.",
1850
+ examples: ["dss app list",],
1851
+ },
1852
+ manifest: {
1853
+ handler: (c, a) => {
1854
+ requireArgs(a, 1, "dss app manifest <appId>");
1855
+ return c.applications.getAppManifest(a[0]);
1856
+ },
1857
+ usage: "dss app manifest <appId>",
1858
+ description: "Get the manifest of a Dataiku App template.",
1859
+ examples: ["dss app manifest my-app",],
1860
+ },
1861
+ instances: {
1862
+ handler: (c, a) => {
1863
+ requireArgs(a, 1, "dss app instances <appId>");
1864
+ return c.applications.listInstances(a[0]);
1865
+ },
1866
+ usage: "dss app instances <appId>",
1867
+ description: "List instances created from a Dataiku App template.",
1868
+ examples: ["dss app instances my-app",],
1869
+ },
1870
+ "create-instance": {
1871
+ handler: (c, a, f) => {
1872
+ requireArgs(a, 1, "dss app create-instance <appId> (--data JSON|--data-file PATH|--stdin)");
1873
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (instance creation payload).");
1874
+ return c.applications.createInstance(a[0], body);
1875
+ },
1876
+ usage: "dss app create-instance <appId> (--data JSON|--data-file PATH|--stdin)",
1877
+ description: "Create an app instance from a Dataiku App template.",
1878
+ examples: ['dss app create-instance my-app --data \'{"targetProjectKey":"NEWPROJ"}\'',],
1879
+ },
1880
+ "instance-manifest": {
1881
+ handler: (c, _a, f) => c.applications.getInstanceManifest(f["project-key"]),
1882
+ usage: "dss app instance-manifest [--project-key KEY]",
1883
+ description: "Get the app manifest of an app-instance project.",
1884
+ examples: ["dss app instance-manifest --project-key MYINSTANCE",],
1885
+ },
1886
+ "save-instance-manifest": {
1887
+ handler: (c, _a, f) => {
1888
+ const manifest = requiredJsonInput(f, "--data, --data-file, or --stdin is required (manifest JSON).");
1889
+ return c.applications.saveInstanceManifest(manifest, f["project-key"]);
1890
+ },
1891
+ usage: "dss app save-instance-manifest (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1892
+ description: "Save the app manifest of an app-instance project (homepage sections, use-as-recipe settings).",
1893
+ examples: ["dss app save-instance-manifest --data-file manifest.json --project-key MYINSTANCE",],
1894
+ },
1895
+ "delete-instance": {
1896
+ handler: async (c, _a, f) => {
1897
+ await c.applications.deleteInstance(f["project-key"]);
1898
+ return { deleted: true, };
1899
+ },
1900
+ usage: "dss app delete-instance [--project-key KEY]",
1901
+ description: "Delete an app-instance project (destructive: removes the instance project).",
1902
+ examples: ["dss app delete-instance --project-key MYINSTANCE",],
1903
+ },
1904
+ "business-app-instance-permissions": {
1905
+ handler: (c, a) => {
1906
+ requireArgs(a, 3, "dss app business-app-instance-permissions <businessAppId> <instanceProjectKey> <userLogin>");
1907
+ return c.applications.getBusinessAppInstanceUserPermissions(a[0], a[1], a[2]);
1908
+ },
1909
+ usage: "dss app business-app-instance-permissions <businessAppId> <instanceProjectKey> <userLogin>",
1910
+ description: "Get a user's effective permissions on a Business App instance.",
1911
+ examples: ["dss app business-app-instance-permissions my-bapp INSTANCEPROJ alice",],
1912
+ },
1913
+ },
1914
+ "business-app": {
1915
+ list: {
1916
+ handler: (c) => c.applications.listBusinessApps(),
1917
+ usage: "dss business-app list",
1918
+ description: "List all Business Apps.",
1919
+ examples: ["dss business-app list",],
1920
+ },
1921
+ get: {
1922
+ handler: (c, a) => {
1923
+ requireArgs(a, 1, "dss business-app get <id>");
1924
+ return c.applications.getBusinessApp(a[0]);
1925
+ },
1926
+ usage: "dss business-app get <id>",
1927
+ description: "Get Business App details.",
1928
+ examples: ["dss business-app get my-bapp",],
1929
+ },
1930
+ settings: {
1931
+ handler: (c, a) => {
1932
+ requireArgs(a, 1, "dss business-app settings <id>");
1933
+ return c.applications.getBusinessAppSettings(a[0]);
1934
+ },
1935
+ usage: "dss business-app settings <id>",
1936
+ description: "Get Business App settings.",
1937
+ examples: ["dss business-app settings my-bapp",],
1938
+ },
1939
+ "save-settings": {
1940
+ handler: (c, a, f) => {
1941
+ requireArgs(a, 1, "dss business-app save-settings <id> (--data JSON|--data-file PATH|--stdin)");
1942
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings JSON).");
1943
+ return c.applications.saveBusinessAppSettings(a[0], body);
1944
+ },
1945
+ usage: "dss business-app save-settings <id> (--data JSON|--data-file PATH|--stdin)",
1946
+ description: "Save Business App settings (admin only; includes connection remapping).",
1947
+ examples: ["dss business-app save-settings my-bapp --data-file settings.json",],
1948
+ },
1949
+ instances: {
1950
+ handler: (c, a) => {
1951
+ requireArgs(a, 1, "dss business-app instances <id>");
1952
+ return c.applications.listBusinessAppInstances(a[0]);
1953
+ },
1954
+ usage: "dss business-app instances <id>",
1955
+ description: "List instances of a Business App.",
1956
+ examples: ["dss business-app instances my-bapp",],
1957
+ },
1958
+ "create-instance": {
1959
+ handler: (c, a, f) => {
1960
+ requireArgs(a, 1, "dss business-app create-instance <id> (--data JSON|--data-file PATH|--stdin)");
1961
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (instance payload).");
1962
+ return c.applications.createBusinessAppInstance(a[0], body);
1963
+ },
1964
+ usage: "dss business-app create-instance <id> (--data JSON|--data-file PATH|--stdin)",
1965
+ description: "Create an instance of a Business App.",
1966
+ examples: ["dss business-app create-instance my-bapp --data '{}'",],
1967
+ },
1968
+ "upgrade-instance": {
1969
+ handler: (c, a) => {
1970
+ requireArgs(a, 2, "dss business-app upgrade-instance <id> <projectKey>");
1971
+ return c.applications.upgradeBusinessAppInstance(a[0], a[1]);
1972
+ },
1973
+ usage: "dss business-app upgrade-instance <id> <projectKey>",
1974
+ description: "Upgrade a Business App instance to the latest version.",
1975
+ examples: ["dss business-app upgrade-instance my-bapp INSTANCEPROJ",],
1976
+ },
1977
+ "install-from-archive": {
1978
+ handler: async (c, a) => {
1979
+ requireArgs(a, 1, "dss business-app install-from-archive <filePath>");
1980
+ await c.applications.installBusinessAppFromArchive(a[0]);
1981
+ return { installed: true, };
1982
+ },
1983
+ usage: "dss business-app install-from-archive <filePath>",
1984
+ description: "Install or upgrade a Business App from a zip archive (admin only).",
1985
+ examples: ["dss business-app install-from-archive ./my-bapp.zip",],
1986
+ },
1987
+ },
1988
+ webapp: {
1989
+ list: {
1990
+ handler: (c, _a, f) => c.webapps.list(f["project-key"]),
1991
+ usage: "dss webapp list [--project-key KEY]",
1992
+ description: "List webapps in a project.",
1993
+ examples: ["dss webapp list",],
1994
+ },
1995
+ "get-settings": {
1996
+ handler: (c, a, f) => {
1997
+ requireArgs(a, 1, "dss webapp get-settings <webappId> [--project-key KEY]");
1998
+ return c.webapps.getSettings(a[0], f["project-key"]);
1999
+ },
2000
+ usage: "dss webapp get-settings <webappId> [--project-key KEY]",
2001
+ description: "Get a webapp's settings.",
2002
+ examples: ["dss webapp get-settings WEBAPP_ID",],
2003
+ },
2004
+ create: {
2005
+ handler: (c, _a, f) => {
2006
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (webapp definition).");
2007
+ return c.webapps.create(body, f["project-key"]);
2008
+ },
2009
+ usage: "dss webapp create (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2010
+ description: "Create a webapp from a JSON definition.",
2011
+ examples: ["dss webapp create --data-file webapp.json",],
2012
+ },
2013
+ "update-settings": {
2014
+ handler: (c, a, f) => {
2015
+ requireArgs(a, 1, "dss webapp update-settings <webappId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2016
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (webapp settings).");
2017
+ return c.webapps.updateSettings(a[0], body, f["project-key"]);
2018
+ },
2019
+ usage: "dss webapp update-settings <webappId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2020
+ description: "Replace a webapp's settings.",
2021
+ examples: ["dss webapp update-settings WEBAPP_ID --data-file webapp.json",],
2022
+ },
2023
+ "stop-backend": {
2024
+ handler: async (c, a, f) => {
2025
+ requireArgs(a, 1, "dss webapp stop-backend <webappId> [--project-key KEY]");
2026
+ await c.webapps.stopBackend(a[0], f["project-key"]);
2027
+ return { stopped: true, };
2028
+ },
2029
+ usage: "dss webapp stop-backend <webappId> [--project-key KEY]",
2030
+ description: "Stop a webapp's backend.",
2031
+ examples: ["dss webapp stop-backend WEBAPP_ID",],
2032
+ },
2033
+ "restart-backend": {
2034
+ handler: async (c, a, f) => {
2035
+ requireArgs(a, 1, "dss webapp restart-backend <webappId> [--project-key KEY]");
2036
+ await c.webapps.startOrRestartBackend(a[0], f["project-key"]);
2037
+ return { restarted: true, };
2038
+ },
2039
+ usage: "dss webapp restart-backend <webappId> [--project-key KEY]",
2040
+ description: "Start or restart a webapp's backend.",
2041
+ examples: ["dss webapp restart-backend WEBAPP_ID",],
2042
+ },
2043
+ "backend-state": {
2044
+ handler: (c, a, f) => {
2045
+ requireArgs(a, 1, "dss webapp backend-state <webappId> [--project-key KEY]");
2046
+ return c.webapps.getBackendState(a[0], f["project-key"]);
2047
+ },
2048
+ usage: "dss webapp backend-state <webappId> [--project-key KEY]",
2049
+ description: "Get a webapp backend's runtime state.",
2050
+ examples: ["dss webapp backend-state WEBAPP_ID",],
2051
+ },
2052
+ },
2053
+ "api-service": {
2054
+ list: {
2055
+ handler: (c, _a, f) => c.apiServices.list(f["project-key"]),
2056
+ usage: "dss api-service list [--project-key KEY]",
2057
+ description: "List API services in a project.",
2058
+ examples: ["dss api-service list",],
2059
+ },
2060
+ create: {
2061
+ handler: (c, a, f) => {
2062
+ requireArgs(a, 1, "dss api-service create <serviceId> [--project-key KEY]");
2063
+ return c.apiServices.create(a[0], f["project-key"]);
2064
+ },
2065
+ usage: "dss api-service create <serviceId> [--project-key KEY]",
2066
+ description: "Create an empty API service.",
2067
+ examples: ["dss api-service create my-service",],
2068
+ },
2069
+ "get-settings": {
2070
+ handler: (c, a, f) => {
2071
+ requireArgs(a, 1, "dss api-service get-settings <serviceId> [--project-key KEY]");
2072
+ return c.apiServices.getSettings(a[0], f["project-key"]);
2073
+ },
2074
+ usage: "dss api-service get-settings <serviceId> [--project-key KEY]",
2075
+ description: "Get an API service's settings (endpoint definitions).",
2076
+ examples: ["dss api-service get-settings my-service",],
2077
+ },
2078
+ "save-settings": {
2079
+ handler: (c, a, f) => {
2080
+ requireArgs(a, 1, "dss api-service save-settings <serviceId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2081
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (service settings).");
2082
+ return c.apiServices.saveSettings(a[0], body, f["project-key"]);
2083
+ },
2084
+ usage: "dss api-service save-settings <serviceId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2085
+ description: "Save an API service's settings.",
2086
+ examples: ["dss api-service save-settings my-service --data-file service.json",],
2087
+ },
2088
+ "list-packages": {
2089
+ handler: (c, a, f) => {
2090
+ requireArgs(a, 1, "dss api-service list-packages <serviceId> [--project-key KEY]");
2091
+ return c.apiServices.listPackages(a[0], f["project-key"]);
2092
+ },
2093
+ usage: "dss api-service list-packages <serviceId> [--project-key KEY]",
2094
+ description: "List deployable packages of an API service.",
2095
+ examples: ["dss api-service list-packages my-service",],
2096
+ },
2097
+ "package-summary": {
2098
+ handler: (c, a, f) => {
2099
+ requireArgs(a, 2, "dss api-service package-summary <serviceId> <packageId> [--project-key KEY]");
2100
+ return c.apiServices.getPackageSummary(a[0], a[1], f["project-key"]);
2101
+ },
2102
+ usage: "dss api-service package-summary <serviceId> <packageId> [--project-key KEY]",
2103
+ description: "Get a package summary.",
2104
+ examples: ["dss api-service package-summary my-service v1",],
2105
+ },
2106
+ "create-package": {
2107
+ handler: (c, a, f) => {
2108
+ requireArgs(a, 2, "dss api-service create-package <serviceId> <packageId> [--project-key KEY]");
2109
+ return c.apiServices.createPackage(a[0], a[1], f["project-key"]);
2110
+ },
2111
+ usage: "dss api-service create-package <serviceId> <packageId> [--project-key KEY]",
2112
+ description: "Build a deployable package from the current service state.",
2113
+ examples: ["dss api-service create-package my-service v1",],
2114
+ },
2115
+ "delete-package": {
2116
+ handler: async (c, a, f) => {
2117
+ requireArgs(a, 2, "dss api-service delete-package <serviceId> <packageId> [--project-key KEY]");
2118
+ await c.apiServices.deletePackage(a[0], a[1], f["project-key"]);
2119
+ return { deleted: true, };
2120
+ },
2121
+ usage: "dss api-service delete-package <serviceId> <packageId> [--project-key KEY]",
2122
+ description: "Delete an API service package.",
2123
+ examples: ["dss api-service delete-package my-service v1",],
2124
+ },
2125
+ "download-package": {
2126
+ handler: async (c, a, f) => {
2127
+ requireArgs(a, 2, "dss api-service download-package <serviceId> <packageId> --output PATH [--project-key KEY]");
2128
+ const out = f["output"];
2129
+ if (!out)
2130
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2131
+ const res = await c.apiServices.downloadPackageArchive(a[0], a[1], f["project-key"]);
2132
+ const buf = Buffer.from(await res.arrayBuffer());
2133
+ writeFileSync(out, buf);
2134
+ return { path: out, bytes: buf.length, };
2135
+ },
2136
+ usage: "dss api-service download-package <serviceId> <packageId> --output PATH [--project-key KEY]",
2137
+ description: "Download an API service package archive to a local file.",
2138
+ examples: ["dss api-service download-package my-service v1 --output ./pkg.zip",],
2139
+ },
2140
+ "publish-package": {
2141
+ handler: (c, a, f) => {
2142
+ requireArgs(a, 2, "dss api-service publish-package <serviceId> <packageId> [--project-key KEY]");
2143
+ return c.apiServices.publishPackage(a[0], a[1], f["project-key"]);
2144
+ },
2145
+ usage: "dss api-service publish-package <serviceId> <packageId> [--project-key KEY]",
2146
+ description: "Publish a package to the API Deployer.",
2147
+ examples: ["dss api-service publish-package my-service v1",],
2148
+ },
2149
+ },
2150
+ "api-deployer": {
2151
+ "list-infras": {
2152
+ handler: (c) => c.apiDeployer.listInfras(),
2153
+ usage: "dss api-deployer list-infras",
2154
+ description: "List API Deployer infrastructures.",
2155
+ examples: ["dss api-deployer list-infras",],
2156
+ },
2157
+ "create-infra": {
2158
+ handler: (c, _a, f) => {
2159
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (infra settings).");
2160
+ return c.apiDeployer.createInfra(body);
2161
+ },
2162
+ usage: "dss api-deployer create-infra (--data JSON|--data-file PATH|--stdin)",
2163
+ description: "Create an API Deployer infrastructure.",
2164
+ examples: ["dss api-deployer create-infra --data-file infra.json",],
2165
+ },
2166
+ "get-infra": {
2167
+ handler: (c, a) => {
2168
+ requireArgs(a, 1, "dss api-deployer get-infra <infraId>");
2169
+ return c.apiDeployer.getInfra(a[0]);
2170
+ },
2171
+ usage: "dss api-deployer get-infra <infraId>",
2172
+ description: "Get an API Deployer infrastructure status.",
2173
+ examples: ["dss api-deployer get-infra prod-infra",],
2174
+ },
2175
+ "delete-infra": {
2176
+ handler: async (c, a) => {
2177
+ requireArgs(a, 1, "dss api-deployer delete-infra <infraId>");
2178
+ await c.apiDeployer.deleteInfra(a[0]);
2179
+ return { deleted: true, };
2180
+ },
2181
+ usage: "dss api-deployer delete-infra <infraId>",
2182
+ description: "Delete an API Deployer infrastructure.",
2183
+ examples: ["dss api-deployer delete-infra prod-infra",],
2184
+ },
2185
+ "list-stages": {
2186
+ handler: (c) => c.apiDeployer.listStages(),
2187
+ usage: "dss api-deployer list-stages",
2188
+ description: "List API Deployer lifecycle stages.",
2189
+ examples: ["dss api-deployer list-stages",],
2190
+ },
2191
+ "list-services": {
2192
+ handler: (c) => c.apiDeployer.listServices(),
2193
+ usage: "dss api-deployer list-services",
2194
+ description: "List published API Deployer services.",
2195
+ examples: ["dss api-deployer list-services",],
2196
+ },
2197
+ "create-service": {
2198
+ handler: (c, _a, f) => {
2199
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (service definition).");
2200
+ return c.apiDeployer.createService(body);
2201
+ },
2202
+ usage: "dss api-deployer create-service (--data JSON|--data-file PATH|--stdin)",
2203
+ description: "Create a published API Deployer service.",
2204
+ examples: ['dss api-deployer create-service --data \'{"id":"my-service"}\'',],
2205
+ },
2206
+ "get-service": {
2207
+ handler: (c, a) => {
2208
+ requireArgs(a, 1, "dss api-deployer get-service <serviceId>");
2209
+ return c.apiDeployer.getService(a[0]);
2210
+ },
2211
+ usage: "dss api-deployer get-service <serviceId>",
2212
+ description: "Get a published service's status (versions + deployments).",
2213
+ examples: ["dss api-deployer get-service my-service",],
2214
+ },
2215
+ "delete-service": {
2216
+ handler: async (c, a) => {
2217
+ requireArgs(a, 1, "dss api-deployer delete-service <serviceId>");
2218
+ await c.apiDeployer.deleteService(a[0]);
2219
+ return { deleted: true, };
2220
+ },
2221
+ usage: "dss api-deployer delete-service <serviceId>",
2222
+ description: "Delete a published API Deployer service.",
2223
+ examples: ["dss api-deployer delete-service my-service",],
2224
+ },
2225
+ "publish-version": {
2226
+ handler: async (c, a) => {
2227
+ requireArgs(a, 2, "dss api-deployer publish-version <serviceId> <archive.zip>");
2228
+ await c.apiDeployer.publishServiceVersion(a[0], a[1]);
2229
+ return { published: true, };
2230
+ },
2231
+ usage: "dss api-deployer publish-version <serviceId> <archive.zip>",
2232
+ description: "Publish (upload) a service version package to the API Deployer.",
2233
+ examples: ["dss api-deployer publish-version my-service ./pkg.zip",],
2234
+ },
2235
+ "delete-version": {
2236
+ handler: async (c, a) => {
2237
+ requireArgs(a, 2, "dss api-deployer delete-version <serviceId> <version>");
2238
+ await c.apiDeployer.deleteServiceVersion(a[0], a[1]);
2239
+ return { deleted: true, };
2240
+ },
2241
+ usage: "dss api-deployer delete-version <serviceId> <version>",
2242
+ description: "Delete a published service version.",
2243
+ examples: ["dss api-deployer delete-version my-service v1",],
2244
+ },
2245
+ "list-deployments": {
2246
+ handler: (c) => c.apiDeployer.listDeployments(),
2247
+ usage: "dss api-deployer list-deployments",
2248
+ description: "List API Deployer deployments.",
2249
+ examples: ["dss api-deployer list-deployments",],
2250
+ },
2251
+ "create-deployment": {
2252
+ handler: (c, _a, f) => {
2253
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2254
+ return c.apiDeployer.createDeployment(body);
2255
+ },
2256
+ usage: "dss api-deployer create-deployment (--data JSON|--data-file PATH|--stdin)",
2257
+ description: "Create an API Deployer deployment (maps a service version to an infra).",
2258
+ examples: ["dss api-deployer create-deployment --data-file deployment.json",],
2259
+ },
2260
+ "get-deployment": {
2261
+ handler: (c, a) => {
2262
+ requireArgs(a, 1, "dss api-deployer get-deployment <deploymentId>");
2263
+ return c.apiDeployer.getDeployment(a[0]);
2264
+ },
2265
+ usage: "dss api-deployer get-deployment <deploymentId>",
2266
+ description: "Get an API Deployer deployment.",
2267
+ examples: ["dss api-deployer get-deployment my-deployment",],
2268
+ },
2269
+ "deployment-status": {
2270
+ handler: (c, a) => {
2271
+ requireArgs(a, 1, "dss api-deployer deployment-status <deploymentId>");
2272
+ return c.apiDeployer.getDeploymentStatus(a[0]);
2273
+ },
2274
+ usage: "dss api-deployer deployment-status <deploymentId>",
2275
+ description: "Get an API Deployer deployment's full health/status.",
2276
+ examples: ["dss api-deployer deployment-status my-deployment",],
2277
+ },
2278
+ "deployment-settings": {
2279
+ handler: (c, a) => {
2280
+ requireArgs(a, 1, "dss api-deployer deployment-settings <deploymentId>");
2281
+ return c.apiDeployer.getDeploymentSettings(a[0]);
2282
+ },
2283
+ usage: "dss api-deployer deployment-settings <deploymentId>",
2284
+ description: "Get an API Deployer deployment's settings.",
2285
+ examples: ["dss api-deployer deployment-settings my-deployment",],
2286
+ },
2287
+ "save-deployment-settings": {
2288
+ handler: async (c, a, f) => {
2289
+ requireArgs(a, 1, "dss api-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)");
2290
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2291
+ await c.apiDeployer.saveDeploymentSettings(a[0], body);
2292
+ return { saved: true, };
2293
+ },
2294
+ usage: "dss api-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)",
2295
+ description: "Save an API Deployer deployment's settings.",
2296
+ examples: ["dss api-deployer save-deployment-settings my-deployment --data-file settings.json",],
2297
+ },
2298
+ deploy: {
2299
+ handler: (c, a) => {
2300
+ requireArgs(a, 1, "dss api-deployer deploy <deploymentId>");
2301
+ return c.apiDeployer.startDeploymentUpdate(a[0]);
2302
+ },
2303
+ usage: "dss api-deployer deploy <deploymentId>",
2304
+ description: "Apply a deployment's settings to its infrastructure (start update).",
2305
+ examples: ["dss api-deployer deploy my-deployment",],
2306
+ },
2307
+ "delete-deployment": {
2308
+ handler: async (c, a) => {
2309
+ requireArgs(a, 1, "dss api-deployer delete-deployment <deploymentId>");
2310
+ await c.apiDeployer.deleteDeployment(a[0]);
2311
+ return { deleted: true, };
2312
+ },
2313
+ usage: "dss api-deployer delete-deployment <deploymentId>",
2314
+ description: "Delete an API Deployer deployment.",
2315
+ examples: ["dss api-deployer delete-deployment my-deployment",],
2316
+ },
2317
+ },
2318
+ bundle: {
2319
+ "list-exported": {
2320
+ handler: (c, _a, f) => c.bundles.listExported(f["project-key"]),
2321
+ usage: "dss bundle list-exported [--project-key KEY]",
2322
+ description: "List bundles exported from a project on the Design node.",
2323
+ examples: ["dss bundle list-exported",],
2324
+ },
2325
+ export: {
2326
+ handler: async (c, a, f) => {
2327
+ requireArgs(a, 1, "dss bundle export <bundleId> [--project-key KEY]");
2328
+ await c.bundles.exportBundle(a[0], f["project-key"]);
2329
+ return { exported: a[0], };
2330
+ },
2331
+ usage: "dss bundle export <bundleId> [--project-key KEY]",
2332
+ description: "Create (or overwrite) an exported Design-node bundle.",
2333
+ examples: ["dss bundle export v1",],
2334
+ },
2335
+ "delete-exported": {
2336
+ handler: async (c, a, f) => {
2337
+ requireArgs(a, 1, "dss bundle delete-exported <bundleId> [--project-key KEY]");
2338
+ await c.bundles.deleteExported(a[0], f["project-key"]);
2339
+ return { deleted: true, };
2340
+ },
2341
+ usage: "dss bundle delete-exported <bundleId> [--project-key KEY]",
2342
+ description: "Delete an exported Design-node bundle.",
2343
+ examples: ["dss bundle delete-exported v1",],
2344
+ },
2345
+ "download-exported": {
2346
+ handler: async (c, a, f) => {
2347
+ requireArgs(a, 1, "dss bundle download-exported <bundleId> --output PATH [--project-key KEY]");
2348
+ const out = f["output"];
2349
+ if (!out)
2350
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2351
+ const res = await c.bundles.downloadExportedArchive(a[0], f["project-key"]);
2352
+ const buf = Buffer.from(await res.arrayBuffer());
2353
+ writeFileSync(out, buf);
2354
+ return { path: out, bytes: buf.length, };
2355
+ },
2356
+ usage: "dss bundle download-exported <bundleId> --output PATH [--project-key KEY]",
2357
+ description: "Download an exported Design-node bundle archive to a local file.",
2358
+ examples: ["dss bundle download-exported v1 --output ./bundle.zip",],
2359
+ },
2360
+ publish: {
2361
+ handler: (c, a, f) => {
2362
+ requireArgs(a, 1, "dss bundle publish <bundleId> [--project-key KEY]");
2363
+ return c.bundles.publish(a[0], f["project-key"]);
2364
+ },
2365
+ usage: "dss bundle publish <bundleId> [--project-key KEY]",
2366
+ description: "Publish a Design-node bundle to the Project Deployer.",
2367
+ examples: ["dss bundle publish v1",],
2368
+ },
2369
+ "list-imported": {
2370
+ handler: (c, _a, f) => c.bundles.listImported(f["project-key"]),
2371
+ usage: "dss bundle list-imported [--project-key KEY]",
2372
+ description: "List bundles imported into a project on the Automation node.",
2373
+ examples: ["dss bundle list-imported",],
2374
+ },
2375
+ "import-from-archive": {
2376
+ handler: (c, a, f) => {
2377
+ requireArgs(a, 1, "dss bundle import-from-archive <serverArchivePath> [--project-key KEY]");
2378
+ return c.bundles.importFromArchive(a[0], f["project-key"]);
2379
+ },
2380
+ usage: "dss bundle import-from-archive <serverArchivePath> [--project-key KEY]",
2381
+ description: "Import a server-side bundle archive into an Automation-node project.",
2382
+ examples: ["dss bundle import-from-archive /data/bundles/v1.zip",],
2383
+ },
2384
+ "import-from-stream": {
2385
+ handler: async (c, a, f) => {
2386
+ requireArgs(a, 1, "dss bundle import-from-stream <filePath> [--project-key KEY]");
2387
+ await c.bundles.importFromStream(a[0], f["project-key"]);
2388
+ return { imported: true, };
2389
+ },
2390
+ usage: "dss bundle import-from-stream <filePath> [--project-key KEY]",
2391
+ description: "Upload and import a local bundle archive into an Automation-node project.",
2392
+ examples: ["dss bundle import-from-stream ./v1.zip",],
2393
+ },
2394
+ activate: {
2395
+ handler: (c, a, f) => {
2396
+ requireArgs(a, 1, "dss bundle activate <bundleId> [--project-key KEY]");
2397
+ return c.bundles.activate(a[0], f["project-key"]);
2398
+ },
2399
+ usage: "dss bundle activate <bundleId> [--project-key KEY]",
2400
+ description: "Activate an imported Automation-node bundle.",
2401
+ examples: ["dss bundle activate v1",],
2402
+ },
2403
+ preload: {
2404
+ handler: (c, a, f) => {
2405
+ requireArgs(a, 1, "dss bundle preload <bundleId> [--project-key KEY]");
2406
+ return c.bundles.preload(a[0], f["project-key"]);
2407
+ },
2408
+ usage: "dss bundle preload <bundleId> [--project-key KEY]",
2409
+ description: "Preload an imported Automation-node bundle (stage data/models).",
2410
+ examples: ["dss bundle preload v1",],
2411
+ },
2412
+ "delete-imported": {
2413
+ handler: async (c, a, f) => {
2414
+ requireArgs(a, 1, "dss bundle delete-imported <bundleId> [--project-key KEY]");
2415
+ await c.bundles.deleteImported(a[0], f["project-key"]);
2416
+ return { deleted: true, };
2417
+ },
2418
+ usage: "dss bundle delete-imported <bundleId> [--project-key KEY]",
2419
+ description: "Delete an imported Automation-node bundle.",
2420
+ examples: ["dss bundle delete-imported v1",],
2421
+ },
2422
+ },
2423
+ "project-deployer": {
2424
+ "list-projects": {
2425
+ handler: (c) => c.projectDeployer.listProjects(),
2426
+ usage: "dss project-deployer list-projects",
2427
+ description: "List published projects on the Project Deployer.",
2428
+ examples: ["dss project-deployer list-projects",],
2429
+ },
2430
+ "create-project": {
2431
+ handler: (c, _a, f) => {
2432
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (published project settings).");
2433
+ return c.projectDeployer.createProject(body);
2434
+ },
2435
+ usage: "dss project-deployer create-project (--data JSON|--data-file PATH|--stdin)",
2436
+ description: "Create a published project on the Project Deployer.",
2437
+ examples: ["dss project-deployer create-project --data-file project.json",],
2438
+ },
2439
+ "upload-bundle": {
2440
+ handler: async (c, a) => {
2441
+ requireArgs(a, 1, "dss project-deployer upload-bundle <filePath>");
2442
+ await c.projectDeployer.uploadBundle(a[0]);
2443
+ return { uploaded: true, };
2444
+ },
2445
+ usage: "dss project-deployer upload-bundle <filePath>",
2446
+ description: "Upload a project bundle archive to the Project Deployer.",
2447
+ examples: ["dss project-deployer upload-bundle ./v1.zip",],
2448
+ },
2449
+ "project-status": {
2450
+ handler: (c, a) => {
2451
+ requireArgs(a, 1, "dss project-deployer project-status <publishedProjectKey>");
2452
+ return c.projectDeployer.getProjectStatus(a[0]);
2453
+ },
2454
+ usage: "dss project-deployer project-status <publishedProjectKey>",
2455
+ description: "Get a published project's status and available bundles.",
2456
+ examples: ["dss project-deployer project-status MYPROJ",],
2457
+ },
2458
+ "list-deployments": {
2459
+ handler: (c) => c.projectDeployer.listDeployments(),
2460
+ usage: "dss project-deployer list-deployments",
2461
+ description: "List Project Deployer deployments.",
2462
+ examples: ["dss project-deployer list-deployments",],
2463
+ },
2464
+ "create-deployment": {
2465
+ handler: (c, _a, f) => {
2466
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2467
+ return c.projectDeployer.createDeployment(body);
2468
+ },
2469
+ usage: "dss project-deployer create-deployment (--data JSON|--data-file PATH|--stdin)",
2470
+ description: "Create a Project Deployer deployment (bundle to infra mapping).",
2471
+ examples: ["dss project-deployer create-deployment --data-file deployment.json",],
2472
+ },
2473
+ "get-deployment": {
2474
+ handler: (c, a) => {
2475
+ requireArgs(a, 1, "dss project-deployer get-deployment <deploymentId>");
2476
+ return c.projectDeployer.getDeployment(a[0]);
2477
+ },
2478
+ usage: "dss project-deployer get-deployment <deploymentId>",
2479
+ description: "Get a Project Deployer deployment.",
2480
+ examples: ["dss project-deployer get-deployment my-deployment",],
2481
+ },
2482
+ "deployment-status": {
2483
+ handler: (c, a) => {
2484
+ requireArgs(a, 1, "dss project-deployer deployment-status <deploymentId>");
2485
+ return c.projectDeployer.getDeploymentStatus(a[0]);
2486
+ },
2487
+ usage: "dss project-deployer deployment-status <deploymentId>",
2488
+ description: "Get a Project Deployer deployment's full health/status.",
2489
+ examples: ["dss project-deployer deployment-status my-deployment",],
2490
+ },
2491
+ "save-deployment-settings": {
2492
+ handler: async (c, a, f) => {
2493
+ requireArgs(a, 1, "dss project-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)");
2494
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2495
+ await c.projectDeployer.saveDeploymentSettings(a[0], body);
2496
+ return { saved: true, };
2497
+ },
2498
+ usage: "dss project-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)",
2499
+ description: "Save a Project Deployer deployment's settings (e.g. bundleId).",
2500
+ examples: [
2501
+ "dss project-deployer save-deployment-settings my-deployment --data-file settings.json",
2502
+ ],
2503
+ },
2504
+ deploy: {
2505
+ handler: (c, a) => {
2506
+ requireArgs(a, 1, "dss project-deployer deploy <deploymentId>");
2507
+ return c.projectDeployer.startUpdate(a[0]);
2508
+ },
2509
+ usage: "dss project-deployer deploy <deploymentId>",
2510
+ description: "Apply a deployment to the Automation node (start update).",
2511
+ examples: ["dss project-deployer deploy my-deployment",],
2512
+ },
2513
+ "delete-deployment": {
2514
+ handler: async (c, a) => {
2515
+ requireArgs(a, 1, "dss project-deployer delete-deployment <deploymentId>");
2516
+ await c.projectDeployer.deleteDeployment(a[0]);
2517
+ return { deleted: true, };
2518
+ },
2519
+ usage: "dss project-deployer delete-deployment <deploymentId>",
2520
+ description: "Delete a Project Deployer deployment.",
2521
+ examples: ["dss project-deployer delete-deployment my-deployment",],
2522
+ },
2523
+ "list-infras": {
2524
+ handler: (c) => c.projectDeployer.listInfras(),
2525
+ usage: "dss project-deployer list-infras",
2526
+ description: "List Project Deployer infrastructures.",
2527
+ examples: ["dss project-deployer list-infras",],
2528
+ },
2529
+ "create-infra": {
2530
+ handler: (c, _a, f) => {
2531
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (infra settings).");
2532
+ return c.projectDeployer.createInfra(body);
2533
+ },
2534
+ usage: "dss project-deployer create-infra (--data JSON|--data-file PATH|--stdin)",
2535
+ description: "Create a Project Deployer infrastructure.",
2536
+ examples: ["dss project-deployer create-infra --data-file infra.json",],
2537
+ },
2538
+ },
2539
+ "project-library": {
2540
+ list: {
2541
+ handler: (c, _a, f) => c.projectLibrary.listContents(f["project-key"]),
2542
+ usage: "dss project-library list [--project-key KEY]",
2543
+ description: "List the project code library (lib/) contents.",
2544
+ examples: ["dss project-library list",],
2545
+ },
2546
+ get: {
2547
+ handler: (c, a, f) => {
2548
+ requireArgs(a, 1, "dss project-library get <path> [--project-key KEY]");
2549
+ return c.projectLibrary.getFile(a[0], f["project-key"]);
2550
+ },
2551
+ usage: "dss project-library get <path> [--project-key KEY]",
2552
+ description: "Print the text content of a project library file.",
2553
+ examples: ["dss project-library get python/mylib/utils.py",],
2554
+ },
2555
+ "get-bytes": {
2556
+ handler: async (c, a, f) => {
2557
+ requireArgs(a, 1, "dss project-library get-bytes <path> --output PATH [--project-key KEY]");
2558
+ const out = f["output"];
2559
+ if (!out)
2560
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2561
+ const bytes = await c.projectLibrary.getFileBytes(a[0], f["project-key"]);
2562
+ writeFileSync(out, bytes);
2563
+ return { path: out, bytes: bytes.length, };
2564
+ },
2565
+ usage: "dss project-library get-bytes <path> --output PATH [--project-key KEY]",
2566
+ description: "Download a project library file's raw bytes to a local file.",
2567
+ examples: ["dss project-library get-bytes static/logo.png --output ./logo.png",],
2568
+ },
2569
+ "create-file": {
2570
+ handler: async (c, a, f) => {
2571
+ requireArgs(a, 1, "dss project-library create-file <path> [--project-key KEY]");
2572
+ await c.projectLibrary.addFile(a[0], f["project-key"]);
2573
+ return { created: a[0], };
2574
+ },
2575
+ usage: "dss project-library create-file <path> [--project-key KEY]",
2576
+ description: "Create an empty file in the project library.",
2577
+ examples: ["dss project-library create-file python/mylib/new.py",],
2578
+ },
2579
+ "create-folder": {
2580
+ handler: async (c, a, f) => {
2581
+ requireArgs(a, 1, "dss project-library create-folder <path> [--project-key KEY]");
2582
+ await c.projectLibrary.addFolder(a[0], f["project-key"]);
2583
+ return { created: a[0], };
2584
+ },
2585
+ usage: "dss project-library create-folder <path> [--project-key KEY]",
2586
+ description: "Create a folder in the project library.",
2587
+ examples: ["dss project-library create-folder python/mylib",],
2588
+ },
2589
+ put: {
2590
+ handler: async (c, a, f) => {
2591
+ requireArgs(a, 1, "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--project-key KEY]");
2592
+ const content = typeof f["content"] === "string"
2593
+ ? f["content"]
2594
+ : typeof f["file"] === "string"
2595
+ ? readFileSync(f["file"], "utf-8")
2596
+ : await readStdinText();
2597
+ await c.projectLibrary.addOrUpdateFile(a[0], content, f["project-key"]);
2598
+ return { updated: a[0], };
2599
+ },
2600
+ usage: "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--project-key KEY]",
2601
+ description: "Create or overwrite a project library file with raw text content.",
2602
+ examples: ["dss project-library put python/mylib/utils.py --file ./utils.py",],
2603
+ },
2604
+ delete: {
2605
+ handler: async (c, a, f) => {
2606
+ requireArgs(a, 1, "dss project-library delete <path> [--project-key KEY]");
2607
+ await c.projectLibrary.deleteFile(a[0], f["project-key"]);
2608
+ return { deleted: a[0], };
2609
+ },
2610
+ usage: "dss project-library delete <path> [--project-key KEY]",
2611
+ description: "Delete a project library file or folder.",
2612
+ examples: ["dss project-library delete python/mylib/old.py",],
2613
+ },
2614
+ rename: {
2615
+ handler: async (c, a, f) => {
2616
+ requireArgs(a, 2, "dss project-library rename <path> <new-name> [--project-key KEY]");
2617
+ await c.projectLibrary.rename(a[0], a[1], f["project-key"]);
2618
+ return { renamed: a[0], to: a[1], };
2619
+ },
2620
+ usage: "dss project-library rename <path> <new-name> [--project-key KEY]",
2621
+ description: "Rename a project library file or folder within its parent.",
2622
+ examples: ["dss project-library rename python/mylib/old.py new.py",],
2623
+ },
2624
+ move: {
2625
+ handler: async (c, a, f) => {
2626
+ requireArgs(a, 2, "dss project-library move <path> <destination-folder> [--project-key KEY]");
2627
+ await c.projectLibrary.move(a[0], a[1], f["project-key"]);
2628
+ return { moved: a[0], to: a[1], };
2629
+ },
2630
+ usage: "dss project-library move <path> <destination-folder> [--project-key KEY]",
2631
+ description: "Move a project library file or folder into another folder.",
2632
+ examples: ["dss project-library move python/old.py python/mylib",],
2633
+ },
2634
+ },
2635
+ "streaming-endpoint": {
2636
+ list: {
2637
+ handler: (c, _a, f) => c.streamingEndpoints.list(f["project-key"]),
2638
+ usage: "dss streaming-endpoint list [--project-key KEY]",
2639
+ description: "List streaming endpoints in a project.",
2640
+ examples: ["dss streaming-endpoint list",],
2641
+ },
2642
+ get: {
2643
+ handler: (c, a, f) => {
2644
+ requireArgs(a, 1, "dss streaming-endpoint get <id> [--project-key KEY]");
2645
+ return c.streamingEndpoints.getSettings(a[0], f["project-key"]);
2646
+ },
2647
+ usage: "dss streaming-endpoint get <id> [--project-key KEY]",
2648
+ description: "Get a streaming endpoint's settings.",
2649
+ examples: ["dss streaming-endpoint get my-stream",],
2650
+ },
2651
+ create: {
2652
+ handler: (c, a, f) => {
2653
+ requireArgs(a, 2, "dss streaming-endpoint create <id> <type> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]");
2654
+ const body = jsonInput(f) ?? {};
2655
+ return c.streamingEndpoints.create(a[0], a[1], body, f["project-key"]);
2656
+ },
2657
+ usage: "dss streaming-endpoint create <id> <type> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]",
2658
+ description: "Create a streaming endpoint of the given type.",
2659
+ examples: ["dss streaming-endpoint create my-stream kafka",],
2660
+ },
2661
+ "update-settings": {
2662
+ handler: async (c, a, f) => {
2663
+ requireArgs(a, 1, "dss streaming-endpoint update-settings <id> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2664
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (endpoint settings).");
2665
+ await c.streamingEndpoints.updateSettings(a[0], body, f["project-key"]);
2666
+ return { updated: a[0], };
2667
+ },
2668
+ usage: "dss streaming-endpoint update-settings <id> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2669
+ description: "Replace a streaming endpoint's settings.",
2670
+ examples: ["dss streaming-endpoint update-settings my-stream --data-file settings.json",],
2671
+ },
2672
+ delete: {
2673
+ handler: async (c, a, f) => {
2674
+ requireArgs(a, 1, "dss streaming-endpoint delete <id> [--project-key KEY]");
2675
+ await c.streamingEndpoints.delete(a[0], f["project-key"]);
2676
+ return { deleted: a[0], };
2677
+ },
2678
+ usage: "dss streaming-endpoint delete <id> [--project-key KEY]",
2679
+ description: "Delete a streaming endpoint.",
2680
+ examples: ["dss streaming-endpoint delete my-stream",],
2681
+ },
2682
+ },
2683
+ "continuous-activity": {
2684
+ list: {
2685
+ handler: (c, _a, f) => c.continuousActivities.list(f["project-key"]),
2686
+ usage: "dss continuous-activity list [--project-key KEY]",
2687
+ description: "List continuous activities in a project.",
2688
+ examples: ["dss continuous-activity list",],
2689
+ },
2690
+ status: {
2691
+ handler: (c, a, f) => {
2692
+ requireArgs(a, 1, "dss continuous-activity status <recipeId> [--project-key KEY]");
2693
+ return c.continuousActivities.getStatus(a[0], f["project-key"]);
2694
+ },
2695
+ usage: "dss continuous-activity status <recipeId> [--project-key KEY]",
2696
+ description: "Get a continuous recipe's desired and effective state.",
2697
+ examples: ["dss continuous-activity status compute_stream",],
2698
+ },
2699
+ start: {
2700
+ handler: (c, a, f) => {
2701
+ requireArgs(a, 1, "dss continuous-activity start <recipeId> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]");
2702
+ return c.continuousActivities.start(a[0], jsonInput(f), f["project-key"]);
2703
+ },
2704
+ usage: "dss continuous-activity start <recipeId> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]",
2705
+ description: "Start a continuous recipe (optional loop restart params via JSON).",
2706
+ examples: ["dss continuous-activity start compute_stream",],
2707
+ },
2708
+ stop: {
2709
+ handler: async (c, a, f) => {
2710
+ requireArgs(a, 1, "dss continuous-activity stop <recipeId> [--project-key KEY]");
2711
+ await c.continuousActivities.stop(a[0], f["project-key"]);
2712
+ return { stopped: a[0], };
2713
+ },
2714
+ usage: "dss continuous-activity stop <recipeId> [--project-key KEY]",
2715
+ description: "Stop a continuous recipe.",
2716
+ examples: ["dss continuous-activity stop compute_stream",],
2717
+ },
2718
+ },
2719
+ statistics: {
2720
+ "list-worksheets": {
2721
+ handler: (c, a, f) => {
2722
+ requireArgs(a, 1, "dss statistics list-worksheets <dataset> [--project-key KEY]");
2723
+ return c.statistics.listWorksheets(a[0], f["project-key"]);
2724
+ },
2725
+ usage: "dss statistics list-worksheets <dataset> [--project-key KEY]",
2726
+ description: "List EDA statistics worksheets for a dataset.",
2727
+ examples: ["dss statistics list-worksheets customers",],
2728
+ },
2729
+ "get-worksheet": {
2730
+ handler: (c, a, f) => {
2731
+ requireArgs(a, 2, "dss statistics get-worksheet <dataset> <worksheetId> [--project-key KEY]");
2732
+ return c.statistics.getWorksheet(a[0], a[1], f["project-key"]);
2733
+ },
2734
+ usage: "dss statistics get-worksheet <dataset> <worksheetId> [--project-key KEY]",
2735
+ description: "Get one statistics worksheet definition.",
2736
+ examples: ["dss statistics get-worksheet customers ws_1",],
2737
+ },
2738
+ "create-worksheet": {
2739
+ handler: (c, a, f) => {
2740
+ requireArgs(a, 1, "dss statistics create-worksheet <dataset> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2741
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
2742
+ return c.statistics.createWorksheet(a[0], body, f["project-key"]);
2743
+ },
2744
+ usage: "dss statistics create-worksheet <dataset> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2745
+ description: "Create a statistics worksheet from a JSON definition.",
2746
+ examples: ["dss statistics create-worksheet customers --data-file ws.json",],
2747
+ },
2748
+ "update-worksheet": {
2749
+ handler: (c, a, f) => {
2750
+ requireArgs(a, 2, "dss statistics update-worksheet <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2751
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
2752
+ return c.statistics.updateWorksheet(a[0], a[1], body, f["project-key"]);
2753
+ },
2754
+ usage: "dss statistics update-worksheet <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2755
+ description: "Replace a statistics worksheet definition.",
2756
+ examples: ["dss statistics update-worksheet customers ws_1 --data-file ws.json",],
2757
+ },
2758
+ "delete-worksheet": {
2759
+ handler: async (c, a, f) => {
2760
+ requireArgs(a, 2, "dss statistics delete-worksheet <dataset> <worksheetId> [--project-key KEY]");
2761
+ await c.statistics.deleteWorksheet(a[0], a[1], f["project-key"]);
2762
+ return { deleted: a[1], };
2763
+ },
2764
+ usage: "dss statistics delete-worksheet <dataset> <worksheetId> [--project-key KEY]",
2765
+ description: "Delete a statistics worksheet.",
2766
+ examples: ["dss statistics delete-worksheet customers ws_1",],
2767
+ },
2768
+ "run-worksheet": {
2769
+ handler: (c, a, f) => {
2770
+ requireArgs(a, 2, "dss statistics run-worksheet <dataset> <worksheetId> [--project-key KEY]");
2771
+ return c.statistics.runWorksheet(a[0], a[1], f["project-key"]);
2772
+ },
2773
+ usage: "dss statistics run-worksheet <dataset> <worksheetId> [--project-key KEY]",
2774
+ description: "Run a statistics worksheet and return the DSS future response.",
2775
+ examples: ["dss statistics run-worksheet customers ws_1",],
2776
+ },
2777
+ "run-card": {
2778
+ handler: (c, a, f) => {
2779
+ requireArgs(a, 2, "dss statistics run-card <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2780
+ const card = requiredJsonInput(f, "--data, --data-file, or --stdin is required (card settings).");
2781
+ return c.statistics.runCard(a[0], a[1], card, f["project-key"]);
2782
+ },
2783
+ usage: "dss statistics run-card <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2784
+ description: "Run a single card in a worksheet context.",
2785
+ examples: ["dss statistics run-card customers ws_1 --data-file card.json",],
2786
+ },
2787
+ "run-computation": {
2788
+ handler: (c, a, f) => {
2789
+ requireArgs(a, 2, "dss statistics run-computation <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2790
+ const computation = requiredJsonInput(f, "--data, --data-file, or --stdin is required (computation settings).");
2791
+ return c.statistics.runComputation(a[0], a[1], computation, f["project-key"]);
2792
+ },
2793
+ usage: "dss statistics run-computation <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2794
+ description: "Run a single computation in a worksheet context.",
2795
+ examples: ["dss statistics run-computation customers ws_1 --data-file comp.json",],
2796
+ },
2797
+ },
2798
+ discussion: {
2799
+ list: {
2800
+ handler: (c, a, f) => {
2801
+ requireArgs(a, 2, "dss discussion list <objectType> <objectId> [--project-key KEY]");
2802
+ return c.discussions.list(a[0], a[1], f["project-key"]);
2803
+ },
2804
+ usage: "dss discussion list <objectType> <objectId> [--project-key KEY]",
2805
+ description: "List discussions attached to a project object.",
2806
+ examples: ["dss discussion list DATASET customers",],
2807
+ },
2808
+ get: {
2809
+ handler: (c, a, f) => {
2810
+ requireArgs(a, 3, "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]");
2811
+ return c.discussions.get(a[0], a[1], a[2], f["project-key"]);
2812
+ },
2813
+ usage: "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]",
2814
+ description: "Get one discussion with its replies.",
2815
+ examples: ["dss discussion get DATASET customers d123",],
2816
+ },
2817
+ create: {
2818
+ handler: (c, a, f) => {
2819
+ requireArgs(a, 2, "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]");
2820
+ const topic = f["topic"];
2821
+ const reply = f["reply"];
2822
+ if (!topic || !reply) {
2823
+ throw new UsageError("--topic and --reply are required.", "missing_required_flag");
2824
+ }
2825
+ return c.discussions.create(a[0], a[1], topic, reply, f["project-key"]);
2826
+ },
2827
+ usage: "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]",
2828
+ description: "Create a discussion with its first reply.",
2829
+ examples: ["dss discussion create DATASET customers --topic Schema --reply Please-review",],
2830
+ },
2831
+ reply: {
2832
+ handler: (c, a, f) => {
2833
+ requireArgs(a, 3, "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]");
2834
+ const text = f["text"];
2835
+ if (!text)
2836
+ throw new UsageError("--text is required.", "missing_required_flag");
2837
+ return c.discussions.reply(a[0], a[1], a[2], text, f["project-key"]);
2838
+ },
2839
+ usage: "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]",
2840
+ description: "Add a reply to an existing discussion.",
2841
+ examples: ["dss discussion reply DATASET customers d123 --text Done",],
2842
+ },
2843
+ },
2844
+ meaning: {
2845
+ list: {
2846
+ handler: (c) => c.meanings.list(),
2847
+ usage: "dss meaning list",
2848
+ description: "List user-defined meanings (column semantic types) on the instance.",
2849
+ examples: ["dss meaning list",],
2850
+ },
2851
+ get: {
2852
+ handler: (c, a) => {
2853
+ requireArgs(a, 1, "dss meaning get <meaningId>");
2854
+ return c.meanings.get(a[0]);
2855
+ },
2856
+ usage: "dss meaning get <meaningId>",
2857
+ description: "Get a user-defined meaning definition.",
2858
+ examples: ["dss meaning get customer_type",],
2859
+ },
2860
+ create: {
2861
+ handler: (c, a, f) => {
2862
+ requireArgs(a, 3, "dss meaning create <id> <label> <type> [--data JSON|--data-file PATH|--stdin]");
2863
+ return c.meanings.create(a[0], a[1], a[2], jsonInput(f) ?? {});
2864
+ },
2865
+ usage: "dss meaning create <id> <label> <type> [--data JSON|--data-file PATH|--stdin]",
2866
+ description: "Create a user-defined meaning (type e.g. VALUES_LIST, VALUES_MAPPING, PATTERN).",
2867
+ examples: ["dss meaning create vip VIP VALUES_LIST",],
2868
+ },
2869
+ update: {
2870
+ handler: (c, a, f) => {
2871
+ requireArgs(a, 1, "dss meaning update <meaningId> (--data JSON|--data-file PATH|--stdin)");
2872
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (meaning definition).");
2873
+ return c.meanings.update(a[0], body);
2874
+ },
2875
+ usage: "dss meaning update <meaningId> (--data JSON|--data-file PATH|--stdin)",
2876
+ description: "Replace a user-defined meaning definition.",
2877
+ examples: ["dss meaning update vip --data-file meaning.json",],
2878
+ },
2879
+ },
2880
+ workspace: {
2881
+ list: {
2882
+ handler: (c) => c.workspaces.list(),
2883
+ usage: "dss workspace list",
2884
+ description: "List collaboration workspaces on the instance.",
2885
+ examples: ["dss workspace list",],
2886
+ },
2887
+ get: {
2888
+ handler: (c, a) => {
2889
+ requireArgs(a, 1, "dss workspace get <workspaceKey>");
2890
+ return c.workspaces.get(a[0]);
2891
+ },
2892
+ usage: "dss workspace get <workspaceKey>",
2893
+ description: "Get a workspace's settings.",
2894
+ examples: ["dss workspace get MY_WS",],
2895
+ },
2896
+ create: {
2897
+ handler: (c, _a, f) => {
2898
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace definition).");
2899
+ return c.workspaces.create(body);
2900
+ },
2901
+ usage: "dss workspace create (--data JSON|--data-file PATH|--stdin)",
2902
+ description: "Create a collaboration workspace.",
2903
+ examples: ["dss workspace create --data-file ws.json",],
2904
+ },
2905
+ "update-settings": {
2906
+ handler: async (c, a, f) => {
2907
+ requireArgs(a, 1, "dss workspace update-settings <workspaceKey> (--data JSON|--data-file PATH|--stdin)");
2908
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace settings).");
2909
+ await c.workspaces.updateSettings(a[0], body);
2910
+ return { updated: a[0], };
2911
+ },
2912
+ usage: "dss workspace update-settings <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
2913
+ description: "Replace a workspace's settings (admin).",
2914
+ examples: ["dss workspace update-settings MY_WS --data-file ws.json",],
2915
+ },
2916
+ delete: {
2917
+ handler: async (c, a) => {
2918
+ requireArgs(a, 1, "dss workspace delete <workspaceKey>");
2919
+ await c.workspaces.delete(a[0]);
2920
+ return { deleted: a[0], };
2921
+ },
2922
+ usage: "dss workspace delete <workspaceKey>",
2923
+ description: "Delete a workspace (admin).",
2924
+ examples: ["dss workspace delete MY_WS",],
2925
+ },
2926
+ "list-objects": {
2927
+ handler: (c, a) => {
2928
+ requireArgs(a, 1, "dss workspace list-objects <workspaceKey>");
2929
+ return c.workspaces.listObjects(a[0]);
2930
+ },
2931
+ usage: "dss workspace list-objects <workspaceKey>",
2932
+ description: "List objects shared in a workspace.",
2933
+ examples: ["dss workspace list-objects MY_WS",],
2934
+ },
2935
+ "add-object": {
2936
+ handler: (c, a, f) => {
2937
+ requireArgs(a, 1, "dss workspace add-object <workspaceKey> (--data JSON|--data-file PATH|--stdin)");
2938
+ const object = requiredJsonInput(f, "--data, --data-file, or --stdin is required (object definition).");
2939
+ return c.workspaces.addObject(a[0], object);
2940
+ },
2941
+ usage: "dss workspace add-object <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
2942
+ description: "Add an object (link or DSS object) to a workspace.",
2943
+ examples: ["dss workspace add-object MY_WS --data-file object.json",],
2944
+ },
2945
+ },
2946
+ metrics: {
2947
+ "dataset-get": {
2948
+ handler: (c, a, f) => {
2949
+ requireArgs(a, 1, "dss metrics dataset-get <dataset> [--project-key KEY]");
2950
+ return c.metrics.getDatasetMetrics(a[0], f["project-key"]);
2951
+ },
2952
+ usage: "dss metrics dataset-get <dataset> [--project-key KEY]",
2953
+ description: "Get the last computed metric values for a dataset.",
2954
+ examples: ["dss metrics dataset-get customers",],
2955
+ },
2956
+ "dataset-compute": {
2957
+ handler: (c, a, f) => {
2958
+ requireArgs(a, 1, "dss metrics dataset-compute <dataset> [--project-key KEY]");
2959
+ return c.metrics.computeDatasetMetrics(a[0], f["project-key"]);
2960
+ },
2961
+ usage: "dss metrics dataset-compute <dataset> [--project-key KEY]",
2962
+ description: "Compute the DSS-configured metrics for a dataset.",
2963
+ examples: ["dss metrics dataset-compute customers",],
2964
+ },
2965
+ "dataset-history": {
2966
+ handler: (c, a, f) => {
2967
+ requireArgs(a, 2, "dss metrics dataset-history <dataset> <metricId> [--project-key KEY]");
2968
+ return c.metrics.getDatasetMetricHistory(a[0], a[1], f["project-key"]);
2969
+ },
2970
+ usage: "dss metrics dataset-history <dataset> <metricId> [--project-key KEY]",
2971
+ description: "Get the history of one dataset metric.",
2972
+ examples: ["dss metrics dataset-history customers records:COUNT_RECORDS",],
2973
+ },
2974
+ "folder-get": {
2975
+ handler: (c, a, f) => {
2976
+ requireArgs(a, 1, "dss metrics folder-get <folderId> [--project-key KEY]");
2977
+ return c.metrics.getFolderMetrics(a[0], f["project-key"]);
2978
+ },
2979
+ usage: "dss metrics folder-get <folderId> [--project-key KEY]",
2980
+ description: "Get the last computed metric values for a managed folder.",
2981
+ examples: ["dss metrics folder-get aBcDeFgH",],
2982
+ },
1751
2983
  },
1752
2984
  doctor: {
1753
2985
  run: {
@@ -2685,6 +3917,36 @@ const commands = {
2685
3917
  description: "List all datasets in a project.",
2686
3918
  examples: ["dss dataset list", "dss dataset list --project-key MYPROJ",],
2687
3919
  },
3920
+ rename: {
3921
+ handler: async (c, a, f) => {
3922
+ requireArgs(a, 2, "dss dataset rename <oldName> <newName> [--project-key KEY]");
3923
+ await c.datasets.rename(a[0], a[1], f["project-key"]);
3924
+ return { renamed: a[0], to: a[1], };
3925
+ },
3926
+ usage: "dss dataset rename <oldName> <newName> [--project-key KEY]",
3927
+ description: "Rename a dataset (updates downstream flow references).",
3928
+ examples: ["dss dataset rename old_ds new_ds",],
3929
+ },
3930
+ "list-partitions": {
3931
+ handler: (c, a, f) => {
3932
+ requireArgs(a, 1, "dss dataset list-partitions <name> [--project-key KEY]");
3933
+ return c.datasets.listPartitions(a[0], f["project-key"]);
3934
+ },
3935
+ usage: "dss dataset list-partitions <name> [--project-key KEY]",
3936
+ description: "List the partitions of a partitioned dataset.",
3937
+ examples: ["dss dataset list-partitions events",],
3938
+ },
3939
+ clear: {
3940
+ handler: async (c, a, f) => {
3941
+ requireArgs(a, 1, "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]");
3942
+ const partitions = f["partitions"];
3943
+ await c.datasets.clear(a[0], partitions, f["project-key"]);
3944
+ return { cleared: a[0], partitions: partitions ?? "ALL", };
3945
+ },
3946
+ usage: "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]",
3947
+ description: "Clear a dataset's data (all, or a partition spec); keeps the dataset.",
3948
+ examples: ["dss dataset clear staging", "dss dataset clear events --partitions 2024-01",],
3949
+ },
2688
3950
  get: {
2689
3951
  handler: (c, a, f) => {
2690
3952
  requireArgs(a, 1, "dss dataset get <name>");
@@ -4483,6 +5745,7 @@ const commands = {
4483
5745
  projectKey: f["project-key"],
4484
5746
  timeoutMs: num(f["timeout"]),
4485
5747
  keepScenario: f["keep"] === true,
5748
+ maxLogBytes: num(f["max-log-bytes"]),
4486
5749
  });
4487
5750
  const result = {
4488
5751
  outcome: run.outcome,
@@ -4491,6 +5754,8 @@ const commands = {
4491
5754
  elapsedMs: run.elapsedMs,
4492
5755
  pollCount: run.pollCount,
4493
5756
  output: run.output ?? "",
5757
+ logTruncated: run.logTruncated,
5758
+ maxLogBytes: run.maxLogBytes,
4494
5759
  };
4495
5760
  if (f["full-log"] === true || run.output === undefined) {
4496
5761
  result.log = run.log;
@@ -4498,7 +5763,7 @@ const commands = {
4498
5763
  return result;
4499
5764
  },
4500
5765
  usage: CODE_RUN_USAGE,
4501
- description: "Run one-off Python in a DSS code env via a throwaway custom-python scenario; returns the script's captured output (stdout+stderr) plus outcome/success. Pass --full-log for the raw DSS run log. Exits 4 on a non-SUCCESS outcome.",
5766
+ description: "Run one-off Python in a DSS code env via a throwaway custom-python scenario; returns the script's captured output (stdout+stderr) plus outcome/success. Log retrieval is capped by --max-log-bytes (default 1048576); pass --full-log to include the capped raw DSS run log. Exits 4 on a non-SUCCESS outcome.",
4502
5767
  examples: [
4503
5768
  "dss code run --file inspect.py",
4504
5769
  "dss code run --file inspect.py --env py39_pandas",
@@ -5218,6 +6483,8 @@ async function runFixtures(flags) {
5218
6483
  const READ_ACTIONS = new Set([
5219
6484
  "cat",
5220
6485
  "contents",
6486
+ "deployment-settings",
6487
+ "deployment-status",
5221
6488
  "diff",
5222
6489
  "download",
5223
6490
  "download-code",
@@ -5253,6 +6520,7 @@ const READ_ACTIONS = new Set([
5253
6520
  "status",
5254
6521
  "rules",
5255
6522
  "settings",
6523
+ "settings-get",
5256
6524
  "status-by-partition",
5257
6525
  "usages",
5258
6526
  ]);
@@ -5284,6 +6552,9 @@ const AUTHENTICATED_AGENT_FLAGS = [
5284
6552
  const COMMANDS_USAGE = "dss commands run [--json]";
5285
6553
  const COMMANDS_DESCRIPTION = "Print the machine-readable command registry for agent planning.";
5286
6554
  const COMMANDS_EXAMPLES = ["dss commands run", "dss commands run --json",];
6555
+ const AGENT_CONTRACT_USAGE = "dss agent contract";
6556
+ const AGENT_CONTRACT_DESCRIPTION = "Print the versioned JSON contract agents should use to drive dss.";
6557
+ const AGENT_CONTRACT_EXAMPLES = ["dss agent contract",];
5287
6558
  const VERSION_USAGE = "dss version";
5288
6559
  const VERSION_DESCRIPTION = "Print the CLI version and git revision as JSON.";
5289
6560
  const VERSION_EXAMPLES = ["dss version", "dss --version",];
@@ -5330,6 +6601,118 @@ function flagKind(name) {
5330
6601
  function registryKey(resource, action) {
5331
6602
  return `${resource}.${action}`;
5332
6603
  }
6604
+ function splitShellLike(input) {
6605
+ const tokens = [];
6606
+ let current = "";
6607
+ let quote;
6608
+ for (let index = 0; index < input.length; index++) {
6609
+ const char = input[index];
6610
+ if (quote) {
6611
+ if (char === quote) {
6612
+ quote = undefined;
6613
+ }
6614
+ else if (char === "\\" && quote === '"' && index + 1 < input.length) {
6615
+ current += input[++index];
6616
+ }
6617
+ else {
6618
+ current += char;
6619
+ }
6620
+ continue;
6621
+ }
6622
+ if (char === "'" || char === '"') {
6623
+ quote = char;
6624
+ continue;
6625
+ }
6626
+ if (/\s/.test(char)) {
6627
+ if (current.length > 0) {
6628
+ tokens.push(current);
6629
+ current = "";
6630
+ }
6631
+ continue;
6632
+ }
6633
+ if (char === "|" || char === "<" || char === ">" || char === ";" || char === "&") {
6634
+ return undefined;
6635
+ }
6636
+ current += char;
6637
+ }
6638
+ if (quote)
6639
+ return undefined;
6640
+ if (current.length > 0)
6641
+ tokens.push(current);
6642
+ return tokens;
6643
+ }
6644
+ function exampleArgv(example) {
6645
+ const tokens = splitShellLike(example);
6646
+ if (!tokens || tokens[0] !== "dss")
6647
+ return undefined;
6648
+ return tokens.slice(1);
6649
+ }
6650
+ function structuredExamples(examples, examplePayload) {
6651
+ return (examples ?? []).map((shell) => {
6652
+ const argv = exampleArgv(shell);
6653
+ return {
6654
+ shell,
6655
+ ...(argv ? { argv, } : {}),
6656
+ ...(examplePayload !== undefined && shell.includes("--data")
6657
+ ? { payload: examplePayload, }
6658
+ : {}),
6659
+ };
6660
+ });
6661
+ }
6662
+ function outputJsonSchema(shape) {
6663
+ if (shape === "array")
6664
+ return { type: "array", items: true, };
6665
+ if (shape === "string")
6666
+ return { type: "string", };
6667
+ return { type: "object", additionalProperties: true, };
6668
+ }
6669
+ function payloadJsonSchema(payloadSchema) {
6670
+ if (!payloadSchema)
6671
+ return undefined;
6672
+ return payloadSchema.jsonShape === "array"
6673
+ ? { type: "array", items: true, }
6674
+ : { type: "object", additionalProperties: true, };
6675
+ }
6676
+ function argvJsonSchema(resource, action, _flags, _positionals, _requiredFlags, _requiredOneOf) {
6677
+ return {
6678
+ type: "object",
6679
+ additionalProperties: true,
6680
+ required: ["argv",],
6681
+ properties: {
6682
+ argv: { type: "array", items: { type: "string", }, minItems: 1, },
6683
+ resource: { const: resource, },
6684
+ action: { const: action, },
6685
+ },
6686
+ };
6687
+ }
6688
+ function unsafeOutputs(resource, action, flags, producesLocalFile) {
6689
+ const outputs = [];
6690
+ if (flags.some((flag) => flag.name === "raw")) {
6691
+ outputs.push({
6692
+ condition: "--raw without --output",
6693
+ kind: "raw-stdout",
6694
+ detail: `${resource} ${action} can intentionally write raw payload bytes/text instead of JSON.`,
6695
+ safeAlternative: flags.some((flag) => flag.name === "output")
6696
+ ? "Pass --output PATH so stdout remains a JSON string containing the path."
6697
+ : "Omit --raw when a JSON stdout value is required.",
6698
+ });
6699
+ }
6700
+ if (producesLocalFile) {
6701
+ outputs.push({
6702
+ condition: "--output or --output-file",
6703
+ kind: "local-file",
6704
+ detail: "Command writes bytes to a local path and returns JSON metadata on stdout.",
6705
+ });
6706
+ }
6707
+ return outputs.length > 0 ? outputs : undefined;
6708
+ }
6709
+ function buildCommandSchemas(resource, action, flags, positionals, requiredFlags, requiredOneOf, payloadSchema, outputShape) {
6710
+ return {
6711
+ argv: argvJsonSchema(resource, action, flags, positionals, requiredFlags, requiredOneOf),
6712
+ ...(payloadSchema ? { input: payloadJsonSchema(payloadSchema), } : {}),
6713
+ output: outputJsonSchema(outputShape),
6714
+ };
6715
+ }
5333
6716
  const EXPLICIT_REGISTRY_OVERRIDES = {
5334
6717
  "dashboard.create": {
5335
6718
  examplePayload: { pages: [], },
@@ -5385,7 +6768,8 @@ function extractPositionals(usage) {
5385
6768
  function inferSideEffect(resource, action) {
5386
6769
  if (resource === "auth")
5387
6770
  return "auth";
5388
- if (resource === "doctor" || resource === "commands" || resource === "fixtures"
6771
+ if (resource === "agent" || resource === "doctor" || resource === "commands"
6772
+ || resource === "fixtures"
5389
6773
  || resource === "version") {
5390
6774
  return "read";
5391
6775
  }
@@ -5395,20 +6779,23 @@ function inferSideEffect(resource, action) {
5395
6779
  return "write";
5396
6780
  if (READ_ACTIONS.has(action))
5397
6781
  return "read";
5398
- if (/^(create|clone|restore|update|delete|set|save|upload|run|build|abort|move|refresh|clear|unload|install|login|logout|add|remove)/
5399
- .test(action)) {
6782
+ if (/^(create|clone|restore|update|delete|set|save|upload|run|build|abort|move|refresh|clear|unload|install|login|logout|add|remove|publish|activate|deploy|import|export|preload|upgrade|start|stop|restart|duplicate|put|rename|reply|compute|organize)/
6783
+ .test(action)
6784
+ // Compound actions whose mutating verb is a suffix (e.g. permissions-set, dataset-compute).
6785
+ || /-(set|compute)$/.test(action)) {
5400
6786
  return "write";
5401
6787
  }
5402
6788
  return "read";
5403
6789
  }
5404
6790
  function inferRequiresAuth(resource) {
5405
- return resource !== "auth"
6791
+ return resource !== "agent"
6792
+ && resource !== "auth"
5406
6793
  && resource !== "commands"
5407
6794
  && resource !== "install-skill"
5408
6795
  && resource !== "version";
5409
6796
  }
5410
6797
  function inferRequiresProject(resource, action, usage) {
5411
- if (resource === "auth" || resource === "doctor" || resource === "commands"
6798
+ if (resource === "agent" || resource === "auth" || resource === "doctor" || resource === "commands"
5412
6799
  || resource === "install-skill" || resource === "version") {
5413
6800
  return false;
5414
6801
  }
@@ -5426,6 +6813,7 @@ const ARRAY_OUTPUT_ACTIONS = new Set([
5426
6813
  "list",
5427
6814
  "list-jupyter",
5428
6815
  "list-sql",
6816
+ "project-timeline",
5429
6817
  "rules",
5430
6818
  "schemas",
5431
6819
  "sessions-jupyter",
@@ -5441,14 +6829,19 @@ const STRING_OUTPUT_ACTIONS = new Set([
5441
6829
  "log-url",
5442
6830
  ]);
5443
6831
  function inferOutputShape(resource, action) {
5444
- if (resource === "auth" || resource === "commands" || resource === "install-skill"
6832
+ if (resource === "agent" || resource === "auth" || resource === "commands"
6833
+ || resource === "install-skill"
5445
6834
  || resource === "version") {
5446
6835
  return "object";
5447
6836
  }
6837
+ if (/^list(-|$)/.test(action))
6838
+ return "array";
5448
6839
  if (ARRAY_OUTPUT_ACTIONS.has(action))
5449
6840
  return "array";
5450
6841
  if (resource === "dataset" && action === "download")
5451
6842
  return "object";
6843
+ if (resource === "project-library" && action === "get")
6844
+ return "string";
5452
6845
  if (STRING_OUTPUT_ACTIONS.has(action))
5453
6846
  return "string";
5454
6847
  return "object";
@@ -5681,47 +7074,58 @@ function buildRegistryEntry(resource, action, meta) {
5681
7074
  const cleanupCommand = meta.cleanupCommand
5682
7075
  ?? EXPLICIT_REGISTRY_OVERRIDES[registryKey(resource, action)]?.cleanupCommand
5683
7076
  ?? cleanupCommandFromDeleteUsage(resource, action);
7077
+ const flagMetadata = flags.map((name) => {
7078
+ const kind = flagKind(name);
7079
+ if (kind === "boolean")
7080
+ return { name, kind, };
7081
+ const hint = valueHints.get(name) ?? GLOBAL_FLAG_VALUE_HINTS[name];
7082
+ if (!hint)
7083
+ return { name, kind, };
7084
+ return {
7085
+ name,
7086
+ kind,
7087
+ valueType: hint.valueType,
7088
+ ...(hint.enumValues ? { enumValues: hint.enumValues, } : {}),
7089
+ };
7090
+ });
7091
+ const positionals = extractPositionals(meta.usage);
7092
+ const outputShape = inferOutputShape(resource, action);
7093
+ const producesLocalFile = meta.usage.includes("--output PATH")
7094
+ || meta.usage.includes("--output-file PATH");
7095
+ const uniqueRequiredFlags = uniqueStrings(requiredFlags);
7096
+ const uniqueOptionalFlags = uniqueStrings(optionalFlags);
7097
+ const unsafe = unsafeOutputs(resource, action, flagMetadata, producesLocalFile);
5684
7098
  return {
5685
7099
  resource,
5686
7100
  action,
5687
7101
  usage: meta.usage,
5688
7102
  description: meta.description,
5689
7103
  examples: meta.examples,
5690
- flags: flags.map((name) => {
5691
- const kind = flagKind(name);
5692
- if (kind === "boolean")
5693
- return { name, kind, };
5694
- const hint = valueHints.get(name) ?? GLOBAL_FLAG_VALUE_HINTS[name];
5695
- if (!hint)
5696
- return { name, kind, };
5697
- return {
5698
- name,
5699
- kind,
5700
- valueType: hint.valueType,
5701
- ...(hint.enumValues ? { enumValues: hint.enumValues, } : {}),
5702
- };
5703
- }),
5704
- positionals: extractPositionals(meta.usage),
7104
+ structuredExamples: structuredExamples(meta.examples, examplePayload),
7105
+ flags: flagMetadata,
7106
+ positionals,
5705
7107
  sideEffect,
5706
7108
  requiresAuth,
5707
7109
  requiresProject,
5708
- outputShape: inferOutputShape(resource, action),
7110
+ outputShape,
5709
7111
  inputContract,
5710
7112
  destructive,
5711
- producesLocalFile: meta.usage.includes("--output PATH")
5712
- || meta.usage.includes("--output-file PATH"),
7113
+ producesLocalFile,
5713
7114
  mutatesDss,
5714
7115
  async: asyncKind,
5715
7116
  idempotency: inferIdempotency(sideEffect, action, meta.usage),
5716
7117
  dryRun: meta.usage.includes("--dry-run"),
5717
- requiredFlags: uniqueStrings(requiredFlags),
5718
- optionalFlags: uniqueStrings(optionalFlags),
7118
+ requiredFlags: uniqueRequiredFlags,
7119
+ optionalFlags: uniqueOptionalFlags,
5719
7120
  ...(requiredOneOf.length > 0 ? { requiredOneOf, } : {}),
5720
7121
  ...(payloadSchema ? { payloadSchema, } : {}),
7122
+ schemas: buildCommandSchemas(resource, action, flagMetadata, positionals, uniqueRequiredFlags, requiredOneOf, payloadSchema, outputShape),
7123
+ ...(unsafe ? { unsafeOutputs: unsafe, } : {}),
5721
7124
  ...(examplePayload !== undefined ? { examplePayload, } : {}),
5722
7125
  ...(cleanupCommand ? { cleanupCommand, } : {}),
5723
7126
  exitCodes: inferExitCodes(asyncKind),
5724
7127
  ...(cleanupHint ? { cleanupHint, } : {}),
7128
+ agentContractVersion: AGENT_CONTRACT_VERSION,
5725
7129
  };
5726
7130
  }
5727
7131
  function buildCommandRegistry() {
@@ -5740,6 +7144,14 @@ function buildCommandRegistry() {
5740
7144
  examples: COMMANDS_EXAMPLES,
5741
7145
  }),
5742
7146
  };
7147
+ registry.agent = {
7148
+ contract: buildRegistryEntry("agent", "contract", {
7149
+ handler: async () => undefined,
7150
+ usage: AGENT_CONTRACT_USAGE,
7151
+ description: AGENT_CONTRACT_DESCRIPTION,
7152
+ examples: AGENT_CONTRACT_EXAMPLES,
7153
+ }),
7154
+ };
5743
7155
  registry.version = {
5744
7156
  run: buildRegistryEntry("version", "run", {
5745
7157
  handler: async () => undefined,
@@ -5794,6 +7206,191 @@ function buildCommandRegistry() {
5794
7206
  }
5795
7207
  return registry;
5796
7208
  }
7209
+ function commandFlagJsonSchema() {
7210
+ return {
7211
+ type: "object",
7212
+ required: ["name", "kind",],
7213
+ additionalProperties: false,
7214
+ properties: {
7215
+ name: { type: "string", },
7216
+ kind: { enum: ["boolean", "value",], },
7217
+ valueType: { type: "string", },
7218
+ enumValues: { type: "array", items: { type: "string", }, },
7219
+ },
7220
+ };
7221
+ }
7222
+ function commandRegistryEntryJsonSchema() {
7223
+ return {
7224
+ type: "object",
7225
+ required: [
7226
+ "resource",
7227
+ "action",
7228
+ "usage",
7229
+ "flags",
7230
+ "positionals",
7231
+ "sideEffect",
7232
+ "requiresAuth",
7233
+ "requiresProject",
7234
+ "outputShape",
7235
+ "inputContract",
7236
+ "schemas",
7237
+ "exitCodes",
7238
+ "agentContractVersion",
7239
+ ],
7240
+ additionalProperties: true,
7241
+ properties: {
7242
+ resource: { type: "string", },
7243
+ action: { type: "string", },
7244
+ usage: { type: "string", },
7245
+ description: { type: "string", },
7246
+ examples: { type: "array", items: { type: "string", }, },
7247
+ structuredExamples: { type: "array", items: { type: "object", additionalProperties: true, }, },
7248
+ flags: { type: "array", items: commandFlagJsonSchema(), },
7249
+ positionals: { type: "array", items: { type: "string", }, },
7250
+ sideEffect: { enum: ["read", "write", "auth",], },
7251
+ requiresAuth: { type: "boolean", },
7252
+ requiresProject: { type: "boolean", },
7253
+ outputShape: { enum: ["object", "array", "string", "void",], },
7254
+ inputContract: { type: "object", additionalProperties: { type: "boolean", }, },
7255
+ destructive: { enum: ["none", "reversible", "destructive",], },
7256
+ producesLocalFile: { type: "boolean", },
7257
+ mutatesDss: { type: "boolean", },
7258
+ async: { enum: ["none", "job", "future",], },
7259
+ idempotency: { enum: ["safe", "convergent", "if-not-exists", "if-exists", "none",], },
7260
+ dryRun: { type: "boolean", },
7261
+ requiredFlags: { type: "array", items: { type: "string", }, },
7262
+ optionalFlags: { type: "array", items: { type: "string", }, },
7263
+ schemas: { type: "object", additionalProperties: true, },
7264
+ unsafeOutputs: { type: "array", items: { type: "object", additionalProperties: true, }, },
7265
+ exitCodes: { type: "object", additionalProperties: { type: "number", }, },
7266
+ agentContractVersion: { const: AGENT_CONTRACT_VERSION, },
7267
+ },
7268
+ };
7269
+ }
7270
+ function commandRegistryJsonSchema() {
7271
+ return {
7272
+ $schema: JSON_SCHEMA_DRAFT,
7273
+ type: "object",
7274
+ additionalProperties: {
7275
+ type: "object",
7276
+ additionalProperties: commandRegistryEntryJsonSchema(),
7277
+ },
7278
+ };
7279
+ }
7280
+ function errorEnvelopeJsonSchema() {
7281
+ return {
7282
+ type: "object",
7283
+ required: ["type", "ok", "error", "code", "category", "exitCode",],
7284
+ additionalProperties: true,
7285
+ properties: {
7286
+ type: { const: "error", },
7287
+ ok: { const: false, },
7288
+ error: { type: "string", },
7289
+ code: { type: "string", },
7290
+ category: { enum: ["usage", "dss", "internal",], },
7291
+ exitCode: { type: "number", },
7292
+ resource: { type: "string", },
7293
+ action: { type: "string", },
7294
+ projectKey: { type: "string", },
7295
+ },
7296
+ };
7297
+ }
7298
+ function warningEventJsonSchema() {
7299
+ return {
7300
+ type: "object",
7301
+ required: ["type", "warnings",],
7302
+ additionalProperties: false,
7303
+ properties: {
7304
+ type: { const: "warning", },
7305
+ warnings: { type: "array", items: { type: "object", additionalProperties: true, }, },
7306
+ },
7307
+ };
7308
+ }
7309
+ function traceEventJsonSchema() {
7310
+ return {
7311
+ type: "object",
7312
+ required: ["type", "phase", "method", "url", "attempt", "maxAttempts",],
7313
+ additionalProperties: false,
7314
+ properties: {
7315
+ type: { const: "trace", },
7316
+ phase: { enum: ["request", "response", "error",], },
7317
+ method: { type: "string", },
7318
+ url: { type: "string", },
7319
+ attempt: { type: "number", },
7320
+ maxAttempts: { type: "number", },
7321
+ status: { type: "number", },
7322
+ elapsedMs: { type: "number", },
7323
+ detail: { type: "string", },
7324
+ },
7325
+ };
7326
+ }
7327
+ function agentContractJsonSchema() {
7328
+ return {
7329
+ $schema: JSON_SCHEMA_DRAFT,
7330
+ $id: AGENT_CONTRACT_SCHEMA_ID,
7331
+ type: "object",
7332
+ required: ["protocol", "agentContractVersion", "cli", "commands", "schemas", "stdio",],
7333
+ additionalProperties: true,
7334
+ properties: {
7335
+ protocol: { const: "dataiku-sdk-agent", },
7336
+ agentContractVersion: { const: AGENT_CONTRACT_VERSION, },
7337
+ cli: { type: "object", additionalProperties: true, },
7338
+ commands: { type: "object", additionalProperties: true, },
7339
+ schemas: { type: "object", additionalProperties: true, },
7340
+ stdio: { type: "object", additionalProperties: true, },
7341
+ },
7342
+ };
7343
+ }
7344
+ function commandActionSummary(registry) {
7345
+ const summary = {};
7346
+ for (const [resource, actions,] of Object.entries(registry)) {
7347
+ summary[resource] = Object.keys(actions).sort();
7348
+ }
7349
+ return summary;
7350
+ }
7351
+ function buildAgentContract() {
7352
+ const registry = buildCommandRegistry();
7353
+ return {
7354
+ protocol: "dataiku-sdk-agent",
7355
+ agentContractVersion: AGENT_CONTRACT_VERSION,
7356
+ cli: cliVersionResult(),
7357
+ commands: {
7358
+ discoveryCommand: "dss commands run",
7359
+ actions: commandActionSummary(registry),
7360
+ },
7361
+ schemas: {
7362
+ agentContract: agentContractJsonSchema(),
7363
+ commandRegistry: commandRegistryJsonSchema(),
7364
+ commandRegistryEntry: commandRegistryEntryJsonSchema(),
7365
+ errorEnvelope: errorEnvelopeJsonSchema(),
7366
+ warningEvent: warningEventJsonSchema(),
7367
+ traceEvent: traceEventJsonSchema(),
7368
+ },
7369
+ stdio: {
7370
+ stdout: {
7371
+ success: "single-json-value",
7372
+ rawEscapeHatches: [
7373
+ "recipe get-payload --raw without --output",
7374
+ "recipe cat --raw without --output",
7375
+ ],
7376
+ },
7377
+ stderr: {
7378
+ format: "jsonl",
7379
+ events: ["warning", "trace", "error",],
7380
+ error: "single-final-error-event-on-nonzero-exit",
7381
+ },
7382
+ },
7383
+ planning: {
7384
+ discoveryCommand: "dss commands run",
7385
+ contractCommand: AGENT_CONTRACT_USAGE,
7386
+ mutatingCommandsAdvertisePlan: true,
7387
+ },
7388
+ compatibility: {
7389
+ fieldsAreAdditiveWithinMajor: true,
7390
+ failFastWhenUnsupported: "Check agentContractVersion before planning commands.",
7391
+ },
7392
+ };
7393
+ }
5797
7394
  function exitCodesOnFailure(entry) {
5798
7395
  return {
5799
7396
  usage: entry.exitCodes.usage,
@@ -6354,6 +7951,31 @@ function commandPlanShape(resource, action, args, flags, entry, projectKey) {
6354
7951
  identifiers: { id, cellId: flags["cell-id"], },
6355
7952
  payload: { retain: num(flags["retain"]), },
6356
7953
  };
7954
+ case "project.permissions-set":
7955
+ return {
7956
+ method: "PUT",
7957
+ endpoint: projectEndpoint("/permissions"),
7958
+ payload: requiredPlanJsonInput(flags, entry.usage),
7959
+ };
7960
+ case "continuous-activity.start":
7961
+ return {
7962
+ method: "POST",
7963
+ endpoint: projectEndpoint(`/continuous-activities/${encodeURIComponent(id)}/start`),
7964
+ identifiers: { recipeId: id, },
7965
+ payload: jsonInput(flags) ?? {},
7966
+ };
7967
+ case "metrics.dataset-compute":
7968
+ return {
7969
+ method: "POST",
7970
+ endpoint: projectEndpoint(`/datasets/${encodeURIComponent(id)}/actions/computeMetrics?partition=`),
7971
+ identifiers: { dataset: id, },
7972
+ };
7973
+ case "flow-zone.organize":
7974
+ return {
7975
+ method: "POST",
7976
+ endpoint: projectEndpoint("/flow/zones"),
7977
+ payload: jsonInput(flags),
7978
+ };
6357
7979
  default:
6358
7980
  return {
6359
7981
  method: action.startsWith("delete") || action === "abort" ? "DELETE" : "POST",
@@ -6703,6 +8325,7 @@ function buildErrorReport(err) {
6703
8325
  const exitCode = errorExitCode(err);
6704
8326
  if (err instanceof UsageError) {
6705
8327
  return {
8328
+ type: "error",
6706
8329
  ok: false,
6707
8330
  error: err.message,
6708
8331
  code: err.code,
@@ -6715,6 +8338,7 @@ function buildErrorReport(err) {
6715
8338
  }
6716
8339
  if (err instanceof CommandResultFailure) {
6717
8340
  return {
8341
+ type: "error",
6718
8342
  ok: false,
6719
8343
  error: err.message,
6720
8344
  code: "long_running_failure",
@@ -6726,6 +8350,7 @@ function buildErrorReport(err) {
6726
8350
  }
6727
8351
  if (err instanceof DataikuError) {
6728
8352
  return {
8353
+ type: "error",
6729
8354
  ok: false,
6730
8355
  error: err.message,
6731
8356
  code: dataikuErrorCode(err.category),
@@ -6746,6 +8371,7 @@ function buildErrorReport(err) {
6746
8371
  }
6747
8372
  const message = err instanceof Error ? err.message : String(err);
6748
8373
  return {
8374
+ type: "error",
6749
8375
  ok: false,
6750
8376
  error: message,
6751
8377
  code: "internal_error",
@@ -6755,7 +8381,7 @@ function buildErrorReport(err) {
6755
8381
  };
6756
8382
  }
6757
8383
  function writeErrorReport(err) {
6758
- process.stderr.write(`${JSON.stringify(buildErrorReport(err), null, 2)}\n`);
8384
+ process.stderr.write(`${JSON.stringify(buildErrorReport(err))}\n`);
6759
8385
  }
6760
8386
  // ---------------------------------------------------------------------------
6761
8387
  // Main
@@ -6867,6 +8493,16 @@ async function main() {
6867
8493
  });
6868
8494
  return;
6869
8495
  }
8496
+ if (resource === "agent") {
8497
+ const action = positional[1];
8498
+ if (!action)
8499
+ throw missingActionError("agent", ["contract",], AGENT_CONTRACT_USAGE);
8500
+ currentCommandContext.action = action;
8501
+ if (action !== "contract")
8502
+ throw unknownActionError("agent", action, ["contract",]);
8503
+ writeCommandResult(buildAgentContract());
8504
+ return;
8505
+ }
6870
8506
  if (resource === "commands") {
6871
8507
  const action = positional[1];
6872
8508
  if (!action)