dexto 1.14.4 → 2.0.0-beta.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 (253) hide show
  1. package/dist/cli/auth/billing.d.ts +0 -6
  2. package/dist/cli/auth/billing.d.ts.map +1 -1
  3. package/dist/cli/auth/billing.js +0 -23
  4. package/dist/cli/auth/constants.d.ts +3 -31
  5. package/dist/cli/auth/constants.d.ts.map +1 -1
  6. package/dist/cli/auth/constants.js +9 -33
  7. package/dist/cli/auth/index.d.ts +2 -9
  8. package/dist/cli/auth/index.d.ts.map +1 -1
  9. package/dist/cli/auth/index.js +2 -7
  10. package/dist/cli/auth/sign-in-runtime.d.ts +12 -0
  11. package/dist/cli/auth/sign-in-runtime.d.ts.map +1 -0
  12. package/dist/cli/auth/sign-in-runtime.js +59 -0
  13. package/dist/cli/cloud/app-scopes.d.ts +4 -0
  14. package/dist/cli/cloud/app-scopes.d.ts.map +1 -0
  15. package/dist/cli/cloud/app-scopes.js +19 -0
  16. package/dist/cli/cloud/command.d.ts +143 -0
  17. package/dist/cli/cloud/command.d.ts.map +1 -0
  18. package/dist/cli/cloud/command.js +202 -0
  19. package/dist/cli/cloud/commands/account.d.ts +11 -0
  20. package/dist/cli/cloud/commands/account.d.ts.map +1 -0
  21. package/dist/cli/cloud/commands/account.js +128 -0
  22. package/dist/cli/cloud/commands/agents.d.ts +3 -0
  23. package/dist/cli/cloud/commands/agents.d.ts.map +1 -0
  24. package/dist/cli/cloud/commands/agents.js +524 -0
  25. package/dist/cli/cloud/commands/api.d.ts +3 -0
  26. package/dist/cli/cloud/commands/api.d.ts.map +1 -0
  27. package/dist/cli/cloud/commands/api.js +26 -0
  28. package/dist/cli/cloud/commands/app-files.d.ts +29 -0
  29. package/dist/cli/cloud/commands/app-files.d.ts.map +1 -0
  30. package/dist/cli/cloud/commands/app-files.js +72 -0
  31. package/dist/cli/cloud/commands/automations.d.ts +3 -0
  32. package/dist/cli/cloud/commands/automations.d.ts.map +1 -0
  33. package/dist/cli/cloud/commands/automations.js +232 -0
  34. package/dist/cli/cloud/commands/chats.d.ts +3 -0
  35. package/dist/cli/cloud/commands/chats.d.ts.map +1 -0
  36. package/dist/cli/cloud/commands/chats.js +189 -0
  37. package/dist/cli/cloud/commands/data-deletions.d.ts +3 -0
  38. package/dist/cli/cloud/commands/data-deletions.d.ts.map +1 -0
  39. package/dist/cli/cloud/commands/data-deletions.js +54 -0
  40. package/dist/cli/cloud/commands/deploys.d.ts +10 -0
  41. package/dist/cli/cloud/commands/deploys.d.ts.map +1 -0
  42. package/dist/cli/cloud/commands/deploys.js +223 -0
  43. package/dist/cli/cloud/commands/drive.d.ts +12 -0
  44. package/dist/cli/cloud/commands/drive.d.ts.map +1 -0
  45. package/dist/cli/cloud/commands/drive.js +320 -0
  46. package/dist/cli/cloud/commands/files.d.ts +24 -0
  47. package/dist/cli/cloud/commands/files.d.ts.map +1 -0
  48. package/dist/cli/cloud/commands/files.js +282 -0
  49. package/dist/cli/cloud/commands/find.d.ts +3 -0
  50. package/dist/cli/cloud/commands/find.d.ts.map +1 -0
  51. package/dist/cli/cloud/commands/find.js +63 -0
  52. package/dist/cli/cloud/commands/models.d.ts +3 -0
  53. package/dist/cli/cloud/commands/models.d.ts.map +1 -0
  54. package/dist/cli/cloud/commands/models.js +248 -0
  55. package/dist/cli/cloud/commands/profile.d.ts +3 -0
  56. package/dist/cli/cloud/commands/profile.d.ts.map +1 -0
  57. package/dist/cli/cloud/commands/profile.js +119 -0
  58. package/dist/cli/cloud/commands/projects.d.ts +5 -0
  59. package/dist/cli/cloud/commands/projects.d.ts.map +1 -0
  60. package/dist/cli/cloud/commands/projects.js +66 -0
  61. package/dist/cli/cloud/commands/publish.d.ts +3 -0
  62. package/dist/cli/cloud/commands/publish.d.ts.map +1 -0
  63. package/dist/cli/cloud/commands/publish.js +138 -0
  64. package/dist/cli/cloud/commands/sandboxes.d.ts +3 -0
  65. package/dist/cli/cloud/commands/sandboxes.d.ts.map +1 -0
  66. package/dist/cli/cloud/commands/sandboxes.js +265 -0
  67. package/dist/cli/cloud/commands/secrets.d.ts +3 -0
  68. package/dist/cli/cloud/commands/secrets.d.ts.map +1 -0
  69. package/dist/cli/cloud/commands/secrets.js +110 -0
  70. package/dist/cli/cloud/commands/skills.d.ts +3 -0
  71. package/dist/cli/cloud/commands/skills.d.ts.map +1 -0
  72. package/dist/cli/cloud/commands/skills.js +202 -0
  73. package/dist/cli/cloud/commands/web.d.ts +3 -0
  74. package/dist/cli/cloud/commands/web.d.ts.map +1 -0
  75. package/dist/cli/cloud/commands/web.js +53 -0
  76. package/dist/cli/cloud/commands/workspace-apps.d.ts +58 -0
  77. package/dist/cli/cloud/commands/workspace-apps.d.ts.map +1 -0
  78. package/dist/cli/cloud/commands/workspace-apps.js +656 -0
  79. package/dist/cli/cloud/commands/workspace.d.ts +36 -0
  80. package/dist/cli/cloud/commands/workspace.d.ts.map +1 -0
  81. package/dist/cli/cloud/commands/workspace.js +279 -0
  82. package/dist/cli/cloud/connection.d.ts +33 -0
  83. package/dist/cli/cloud/connection.d.ts.map +1 -0
  84. package/dist/cli/cloud/connection.js +38 -0
  85. package/dist/cli/cloud/events.d.ts +63 -0
  86. package/dist/cli/cloud/events.d.ts.map +1 -0
  87. package/dist/cli/cloud/events.js +72 -0
  88. package/dist/cli/cloud/host.d.ts +9 -0
  89. package/dist/cli/cloud/host.d.ts.map +1 -0
  90. package/dist/cli/cloud/host.js +105 -0
  91. package/dist/cli/cloud/local-chats.d.ts +73 -0
  92. package/dist/cli/cloud/local-chats.d.ts.map +1 -0
  93. package/dist/cli/cloud/local-chats.js +441 -0
  94. package/dist/cli/cloud/output.d.ts +34 -0
  95. package/dist/cli/cloud/output.d.ts.map +1 -0
  96. package/dist/cli/cloud/output.js +76 -0
  97. package/dist/cli/cloud/run.d.ts +26 -0
  98. package/dist/cli/cloud/run.d.ts.map +1 -0
  99. package/dist/cli/cloud/run.js +444 -0
  100. package/dist/cli/cloud/runtime.d.ts +33 -0
  101. package/dist/cli/cloud/runtime.d.ts.map +1 -0
  102. package/dist/cli/cloud/runtime.js +86 -0
  103. package/dist/cli/cloud/tar.d.ts +9 -0
  104. package/dist/cli/cloud/tar.d.ts.map +1 -0
  105. package/dist/cli/cloud/tar.js +69 -0
  106. package/dist/cli/cloud/transfer.d.ts +13 -0
  107. package/dist/cli/cloud/transfer.d.ts.map +1 -0
  108. package/dist/cli/cloud/transfer.js +35 -0
  109. package/dist/cli/cloud/v1.d.ts +19 -0
  110. package/dist/cli/cloud/v1.d.ts.map +1 -0
  111. package/dist/cli/cloud/v1.js +65 -0
  112. package/dist/cli/cloud/zip.d.ts +8 -0
  113. package/dist/cli/cloud/zip.d.ts.map +1 -0
  114. package/dist/cli/cloud/zip.js +66 -0
  115. package/dist/cli/commands/auth/sign-in-commands.d.ts +62 -0
  116. package/dist/cli/commands/auth/sign-in-commands.d.ts.map +1 -0
  117. package/dist/cli/commands/auth/sign-in-commands.js +247 -0
  118. package/dist/cli/commands/auth/sign-in-context.d.ts +16 -0
  119. package/dist/cli/commands/auth/sign-in-context.d.ts.map +1 -0
  120. package/dist/cli/commands/auth/sign-in-context.js +68 -0
  121. package/dist/cli/commands/cloud/register.d.ts +5 -0
  122. package/dist/cli/commands/cloud/register.d.ts.map +1 -1
  123. package/dist/cli/commands/cloud/register.js +42 -24
  124. package/dist/cli/commands/create-app.js +5 -6
  125. package/dist/cli/commands/create-image.d.ts.map +1 -1
  126. package/dist/cli/commands/create-image.js +9 -10
  127. package/dist/cli/commands/index.d.ts +0 -2
  128. package/dist/cli/commands/index.d.ts.map +1 -1
  129. package/dist/cli/commands/index.js +0 -2
  130. package/dist/cli/commands/init.d.ts +0 -2
  131. package/dist/cli/commands/init.d.ts.map +1 -1
  132. package/dist/cli/commands/init.js +5 -26
  133. package/dist/cli/commands/run/headless.js +2 -2
  134. package/dist/cli/commands/run/output.d.ts +29 -10
  135. package/dist/cli/commands/run/output.d.ts.map +1 -1
  136. package/dist/cli/commands/run/output.js +44 -22
  137. package/dist/cli/commands/run/register.d.ts.map +1 -1
  138. package/dist/cli/commands/run/register.js +21 -9
  139. package/dist/cli/commands/session/register.d.ts.map +1 -1
  140. package/dist/cli/commands/session/register.js +51 -21
  141. package/dist/cli/commands/session-commands.js +1 -1
  142. package/dist/cli/commands/setup.js +17 -14
  143. package/dist/cli/help-json.d.ts +22 -0
  144. package/dist/cli/help-json.d.ts.map +1 -0
  145. package/dist/cli/help-json.js +20 -0
  146. package/dist/cli/modes/cli.d.ts.map +1 -1
  147. package/dist/cli/modes/cli.js +42 -9
  148. package/dist/cli/modes/server.js +8 -8
  149. package/dist/cli/modes/web.js +3 -3
  150. package/dist/cli/utils/dexto-auth-check.d.ts +1 -1
  151. package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -1
  152. package/dist/cli/utils/dexto-auth-check.js +4 -5
  153. package/dist/cli/utils/dexto-setup.d.ts +4 -5
  154. package/dist/cli/utils/dexto-setup.d.ts.map +1 -1
  155. package/dist/cli/utils/dexto-setup.js +17 -14
  156. package/dist/cli/utils/provider-setup.js +1 -1
  157. package/dist/cli/utils/scaffolding-utils.d.ts +9 -3
  158. package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
  159. package/dist/cli/utils/scaffolding-utils.js +48 -40
  160. package/dist/cli/utils/version-check.d.ts.map +1 -1
  161. package/dist/cli/utils/version-check.js +2 -1
  162. package/dist/index-main.js +33 -65
  163. package/package.json +8 -7
  164. package/dist/cli/auth/api-client.d.ts +0 -125
  165. package/dist/cli/auth/api-client.d.ts.map +0 -1
  166. package/dist/cli/auth/api-client.js +0 -585
  167. package/dist/cli/auth/device.d.ts +0 -14
  168. package/dist/cli/auth/device.d.ts.map +0 -1
  169. package/dist/cli/auth/device.js +0 -84
  170. package/dist/cli/auth/dexto-api-key.d.ts +0 -34
  171. package/dist/cli/auth/dexto-api-key.d.ts.map +0 -1
  172. package/dist/cli/auth/dexto-api-key.js +0 -160
  173. package/dist/cli/auth/login-persistence.d.ts +0 -15
  174. package/dist/cli/auth/login-persistence.d.ts.map +0 -1
  175. package/dist/cli/auth/login-persistence.js +0 -72
  176. package/dist/cli/auth/oauth.d.ts +0 -39
  177. package/dist/cli/auth/oauth.d.ts.map +0 -1
  178. package/dist/cli/auth/oauth.js +0 -434
  179. package/dist/cli/auth/service.d.ts +0 -24
  180. package/dist/cli/auth/service.d.ts.map +0 -1
  181. package/dist/cli/auth/service.js +0 -161
  182. package/dist/cli/auth/types.d.ts +0 -11
  183. package/dist/cli/auth/types.d.ts.map +0 -1
  184. package/dist/cli/auth/types.js +0 -1
  185. package/dist/cli/cloud-chat.d.ts +0 -18
  186. package/dist/cli/cloud-chat.d.ts.map +0 -1
  187. package/dist/cli/cloud-chat.js +0 -734
  188. package/dist/cli/commands/auth/index.d.ts +0 -4
  189. package/dist/cli/commands/auth/index.d.ts.map +0 -1
  190. package/dist/cli/commands/auth/index.js +0 -4
  191. package/dist/cli/commands/auth/login.d.ts +0 -12
  192. package/dist/cli/commands/auth/login.d.ts.map +0 -1
  193. package/dist/cli/commands/auth/login.js +0 -153
  194. package/dist/cli/commands/auth/logout.d.ts +0 -5
  195. package/dist/cli/commands/auth/logout.d.ts.map +0 -1
  196. package/dist/cli/commands/auth/logout.js +0 -81
  197. package/dist/cli/commands/auth/register.d.ts +0 -3
  198. package/dist/cli/commands/auth/register.d.ts.map +0 -1
  199. package/dist/cli/commands/auth/register.js +0 -96
  200. package/dist/cli/commands/auth/status.d.ts +0 -2
  201. package/dist/cli/commands/auth/status.d.ts.map +0 -1
  202. package/dist/cli/commands/auth/status.js +0 -22
  203. package/dist/cli/commands/billing/index.d.ts +0 -2
  204. package/dist/cli/commands/billing/index.d.ts.map +0 -1
  205. package/dist/cli/commands/billing/index.js +0 -2
  206. package/dist/cli/commands/billing/register.d.ts +0 -3
  207. package/dist/cli/commands/billing/register.d.ts.map +0 -1
  208. package/dist/cli/commands/billing/register.js +0 -20
  209. package/dist/cli/commands/billing/status.d.ts +0 -8
  210. package/dist/cli/commands/billing/status.d.ts.map +0 -1
  211. package/dist/cli/commands/billing/status.js +0 -71
  212. package/dist/cli/commands/cloud/discovery.d.ts +0 -17
  213. package/dist/cli/commands/cloud/discovery.d.ts.map +0 -1
  214. package/dist/cli/commands/cloud/discovery.js +0 -88
  215. package/dist/cli/commands/deploy/client.d.ts +0 -113
  216. package/dist/cli/commands/deploy/client.d.ts.map +0 -1
  217. package/dist/cli/commands/deploy/client.js +0 -519
  218. package/dist/cli/commands/deploy/config.d.ts +0 -37
  219. package/dist/cli/commands/deploy/config.d.ts.map +0 -1
  220. package/dist/cli/commands/deploy/config.js +0 -144
  221. package/dist/cli/commands/deploy/entry-agent.d.ts +0 -3
  222. package/dist/cli/commands/deploy/entry-agent.d.ts.map +0 -1
  223. package/dist/cli/commands/deploy/entry-agent.js +0 -70
  224. package/dist/cli/commands/deploy/index.d.ts +0 -12
  225. package/dist/cli/commands/deploy/index.d.ts.map +0 -1
  226. package/dist/cli/commands/deploy/index.js +0 -370
  227. package/dist/cli/commands/deploy/links.d.ts +0 -3
  228. package/dist/cli/commands/deploy/links.d.ts.map +0 -1
  229. package/dist/cli/commands/deploy/links.js +0 -53
  230. package/dist/cli/commands/deploy/register.d.ts +0 -6
  231. package/dist/cli/commands/deploy/register.d.ts.map +0 -1
  232. package/dist/cli/commands/deploy/register.js +0 -128
  233. package/dist/cli/commands/deploy/snapshot.d.ts +0 -12
  234. package/dist/cli/commands/deploy/snapshot.d.ts.map +0 -1
  235. package/dist/cli/commands/deploy/snapshot.js +0 -76
  236. package/dist/cli/commands/deploy/state.d.ts +0 -13
  237. package/dist/cli/commands/deploy/state.d.ts.map +0 -1
  238. package/dist/cli/commands/deploy/state.js +0 -122
  239. package/dist/cli/commands/span/register.d.ts +0 -6
  240. package/dist/cli/commands/span/register.d.ts.map +0 -1
  241. package/dist/cli/commands/span/register.js +0 -25
  242. package/dist/cli/commands/trace/client.d.ts +0 -98
  243. package/dist/cli/commands/trace/client.d.ts.map +0 -1
  244. package/dist/cli/commands/trace/client.js +0 -150
  245. package/dist/cli/commands/trace/format.d.ts +0 -5
  246. package/dist/cli/commands/trace/format.d.ts.map +0 -1
  247. package/dist/cli/commands/trace/format.js +0 -58
  248. package/dist/cli/commands/trace/index.d.ts +0 -21
  249. package/dist/cli/commands/trace/index.d.ts.map +0 -1
  250. package/dist/cli/commands/trace/index.js +0 -49
  251. package/dist/cli/commands/trace/register.d.ts +0 -6
  252. package/dist/cli/commands/trace/register.d.ts.map +0 -1
  253. package/dist/cli/commands/trace/register.js +0 -71
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const apiCommands: readonly Command[];
3
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoD,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAgC/F,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EAAU,CAAC"}
@@ -0,0 +1,26 @@
1
+ // `cloud api`: call any /v1 operation with the sign-in, for what no command covers yet.
2
+ import { argument, BODY_OPTIONS, readJsonBody, UsageError } from '../command.js';
3
+ import { fetchV1, v1Failure } from '../v1.js';
4
+ const METHODS = new Set(['DELETE', 'GET', 'PATCH', 'POST', 'PUT']);
5
+ const api = {
6
+ arguments: '<method> <path>',
7
+ options: BODY_OPTIONS,
8
+ path: ['cloud', 'api'],
9
+ summary: 'Call a /v1 path, such as: dexto cloud api GET /v1/agents. Prints the response body.',
10
+ async run(context, input) {
11
+ const method = argument(input, 0, 'method').toUpperCase();
12
+ if (!METHODS.has(method))
13
+ throw new UsageError(`Unknown method ${method}.`);
14
+ const body = await readJsonBody(context, input);
15
+ const response = await fetchV1(context, method, argument(input, 1, 'path'), body === null ? null : JSON.stringify(body));
16
+ const text = await response.text();
17
+ if (response.headers.get('content-type')?.includes('application/json') === true)
18
+ context.runtime.writeOutput(`${JSON.stringify(JSON.parse(text), null, 2)}\n`);
19
+ else
20
+ context.runtime.writeOutput(text.endsWith('\n') || text.length === 0 ? text : `${text}\n`);
21
+ if (!response.ok)
22
+ throw v1Failure(context, response.status, text);
23
+ return 0;
24
+ },
25
+ };
26
+ export const apiCommands = [api];
@@ -0,0 +1,29 @@
1
+ import { type CommandContext } from '../command.js';
2
+ /** The JSON Schema `format` of a string that takes a Drive file, as `drive:<id>`. */
3
+ export declare const DRIVE_FILE_FORMAT = "dexto-drive-file";
4
+ /**
5
+ * How a field takes files: as the reference itself, or as an object whose `property` is the
6
+ * reference, with the file's `name` and `mimeType` beside it where the object has them. `list`
7
+ * says the field takes several.
8
+ */
9
+ export interface FileField {
10
+ readonly list: boolean;
11
+ readonly slot: {
12
+ readonly kind: 'reference';
13
+ } | {
14
+ readonly kind: 'object';
15
+ readonly mimeType: boolean;
16
+ readonly name: boolean;
17
+ readonly property: string;
18
+ };
19
+ }
20
+ /** A field's file slot, from its schema: a string of the Drive file format, alone or in an object. */
21
+ export declare function fileFieldOf(property: Record<string, unknown>): FileField | null;
22
+ /**
23
+ * The field's values with each local path uploaded into the app's Drive folder: a link (`https:`,
24
+ * `drive:`) is kept as it is, and a value given as JSON is left alone.
25
+ */
26
+ export declare function attachFiles(context: CommandContext, appId: string, field: FileField, values: readonly unknown[]): Promise<unknown[]>;
27
+ /** A value naming a local file to upload, rather than a link or JSON given as it is. */
28
+ export declare function isLocalFile(value: unknown): boolean;
29
+ //# sourceMappingURL=app-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-files.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/app-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAGlE,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EACP;QAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;KAAE,GAC9B;QACI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC7B,CAAC;CACX;AAED,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAI/E;AAwBD;;;GAGG;AACH,wBAAsB,WAAW,CAC7B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,SAAS,OAAO,EAAE,GAC3B,OAAO,CAAC,OAAO,EAAE,CAAC,CAwBpB;AAKD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEnD"}
@@ -0,0 +1,72 @@
1
+ // Local files given for an App action's file fields: uploaded to the app's Drive folder, then referred to.
2
+ import { isJsonObject } from '../command.js';
3
+ import { putAppFile } from './drive.js';
4
+ /** The JSON Schema `format` of a string that takes a Drive file, as `drive:<id>`. */
5
+ export const DRIVE_FILE_FORMAT = 'dexto-drive-file';
6
+ /** A field's file slot, from its schema: a string of the Drive file format, alone or in an object. */
7
+ export function fileFieldOf(property) {
8
+ const items = property.type === 'array' && isJsonObject(property.items) ? property.items : null;
9
+ const slot = slotOf(items ?? property);
10
+ return slot === null ? null : { list: items !== null, slot };
11
+ }
12
+ function slotOf(schema) {
13
+ if (takesFile(schema))
14
+ return { kind: 'reference' };
15
+ if (schema.type !== 'object' || !isJsonObject(schema.properties))
16
+ return null;
17
+ const { properties } = schema;
18
+ const property = Object.keys(properties).find((name) => {
19
+ const each = properties[name];
20
+ return isJsonObject(each) && takesFile(each);
21
+ });
22
+ return property === undefined
23
+ ? null
24
+ : {
25
+ kind: 'object',
26
+ mimeType: isJsonObject(properties.mimeType),
27
+ name: isJsonObject(properties.name),
28
+ property,
29
+ };
30
+ }
31
+ function takesFile(schema) {
32
+ return schema.type === 'string' && schema.format === DRIVE_FILE_FORMAT;
33
+ }
34
+ /**
35
+ * The field's values with each local path uploaded into the app's Drive folder: a link (`https:`,
36
+ * `drive:`) is kept as it is, and a value given as JSON is left alone.
37
+ */
38
+ export async function attachFiles(context, appId, field, values) {
39
+ const attached = [];
40
+ for (const value of values) {
41
+ if (typeof value !== 'string') {
42
+ attached.push(value);
43
+ continue;
44
+ }
45
+ const file = LINK.test(value)
46
+ ? { mimeType: null, name: null, uri: value }
47
+ : await uploadAppFile(context, appId, value);
48
+ const { slot } = field;
49
+ attached.push(slot.kind === 'reference'
50
+ ? file.uri
51
+ : {
52
+ [slot.property]: file.uri,
53
+ ...(slot.name && file.name !== null ? { name: file.name } : {}),
54
+ ...(slot.mimeType && file.mimeType !== null
55
+ ? { mimeType: file.mimeType }
56
+ : {}),
57
+ });
58
+ }
59
+ return attached;
60
+ }
61
+ /** A value that already refers to a file, rather than naming a local one. */
62
+ const LINK = /^(?:https?:\/\/|drive:)/iu;
63
+ /** A value naming a local file to upload, rather than a link or JSON given as it is. */
64
+ export function isLocalFile(value) {
65
+ return typeof value === 'string' && !LINK.test(value);
66
+ }
67
+ async function uploadAppFile(context, appId, localPath) {
68
+ const file = await putAppFile(context, localPath, appId);
69
+ const uri = `drive:${file.id}`;
70
+ context.output.note(`Uploaded ${localPath} to your Drive as ${uri}.`);
71
+ return { mimeType: file.mimeType, name: file.name, uri };
72
+ }
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const automationCommands: readonly Command[];
3
+ //# sourceMappingURL=automations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/automations.ts"],"names":[],"mappings":"AAIA,OAAO,EAYH,KAAK,OAAO,EAEf,MAAM,eAAe,CAAC;AAoSvB,eAAO,MAAM,kBAAkB,EAAE,SAAS,OAAO,EAWhD,CAAC"}
@@ -0,0 +1,232 @@
1
+ // `cloud automations`: run the project's agents on a schedule or on a signed webhook.
2
+ import { unwrap } from '@dexto/cloud-client';
3
+ import { argument, BODY_OPTIONS, PAGE_OPTIONS, pageQuery, readJsonBody, requireConsent, stringOption, UsageError, YES_OPTION, flag, isJsonObject, } from '../command.js';
4
+ function automationPath(id) {
5
+ return { params: { path: { automation_id: id } } };
6
+ }
7
+ const COLUMNS = [
8
+ { header: 'id', value: (automation) => automation.id },
9
+ { header: 'name', value: (automation) => automation.name },
10
+ { header: 'status', value: (automation) => automation.status },
11
+ { header: 'trigger', value: (automation) => describeTrigger(automation) },
12
+ { header: 'agent', value: (automation) => automation.target.agent_id },
13
+ { header: 'last fired', value: (automation) => automation.last_fired_at },
14
+ ];
15
+ const list = {
16
+ options: PAGE_OPTIONS,
17
+ path: ['cloud', 'automations', 'list'],
18
+ summary: "List the project's automations.",
19
+ async run(context, input) {
20
+ context.output.list(await unwrap(await (await context.client()).GET('/v1/automations', {
21
+ params: { query: pageQuery(input) },
22
+ })), COLUMNS);
23
+ },
24
+ };
25
+ const get = {
26
+ arguments: '<automation_id>',
27
+ path: ['cloud', 'automations', 'get'],
28
+ summary: 'Show an automation.',
29
+ async run(context, input) {
30
+ context.output.record(await unwrap(await (await context.client()).GET('/v1/automations/{automation_id}', automationPath(argument(input, 0, 'automation_id')))));
31
+ },
32
+ };
33
+ const create = {
34
+ options: {
35
+ ...BODY_OPTIONS,
36
+ agent: { description: 'The agent each firing runs.', type: 'string', valueName: 'ID' },
37
+ at: {
38
+ description: 'Fire once at this ISO 8601 time with an offset.',
39
+ type: 'string',
40
+ valueName: 'TIME',
41
+ },
42
+ cron: { description: 'Fire on this five-field cron expression.', type: 'string' },
43
+ message: { description: 'The message each firing sends the agent.', type: 'string' },
44
+ name: { description: 'Display name.', type: 'string' },
45
+ session: {
46
+ description: 'Send every firing to this session instead of a new one each time.',
47
+ type: 'string',
48
+ valueName: 'ID',
49
+ },
50
+ timezone: {
51
+ description: 'The IANA timezone the cron is read in (default UTC).',
52
+ type: 'string',
53
+ },
54
+ webhook: { description: 'Fire on each signed request to a webhook URL.', type: 'boolean' },
55
+ },
56
+ path: ['cloud', 'automations', 'create'],
57
+ summary: 'Create an automation from flags (--name --agent --message and one of --cron, --at, --webhook) or --file.',
58
+ async run(context, input) {
59
+ const body = await readJsonBody(context, input);
60
+ const definition = body === null ? fromFlags(input) : asCreateInput(body);
61
+ const automation = await unwrap(await (await context.client()).POST('/v1/automations', { body: definition }));
62
+ if (context.output.json)
63
+ return context.output.record(automation);
64
+ context.runtime.writeOutput(`Created automation ${automation.id} (${automation.name}).\n`);
65
+ if (automation.trigger.type === 'webhook') {
66
+ context.runtime.writeOutput(`Webhook URL: ${automation.trigger.url}\n`);
67
+ context.runtime.writeOutput(`Signing secret (shown once): ${automation.webhook_secret ?? '-'}\n`);
68
+ }
69
+ else if (automation.trigger.next_run_at !== null)
70
+ context.runtime.writeOutput(`Next run: ${automation.trigger.next_run_at}\n`);
71
+ },
72
+ };
73
+ const update = {
74
+ arguments: '<automation_id>',
75
+ options: {
76
+ ...BODY_OPTIONS,
77
+ message: { description: 'The message each firing sends.', type: 'string' },
78
+ name: { description: 'Display name.', type: 'string' },
79
+ },
80
+ path: ['cloud', 'automations', 'update'],
81
+ summary: "Change an automation's name or message, or any field with --file.",
82
+ async run(context, input) {
83
+ const body = await readJsonBody(context, input);
84
+ const name = stringOption(input, 'name');
85
+ const message = stringOption(input, 'message');
86
+ const changes = body === null
87
+ ? {
88
+ ...(name === undefined ? {} : { name }),
89
+ ...(message === undefined ? {} : { target: { message } }),
90
+ }
91
+ : asUpdateInput(body);
92
+ const automation = await unwrap(await (await context.client()).PATCH('/v1/automations/{automation_id}', {
93
+ ...automationPath(argument(input, 0, 'automation_id')),
94
+ body: changes,
95
+ }));
96
+ context.output.result(automation, `Updated automation ${automation.id}.`);
97
+ },
98
+ };
99
+ function lifecycle(action, summary) {
100
+ return {
101
+ arguments: '<automation_id>',
102
+ ...(action === 'delete' ? { options: YES_OPTION } : {}),
103
+ path: ['cloud', 'automations', action],
104
+ summary,
105
+ async run(context, input) {
106
+ const client = await context.client();
107
+ const id = argument(input, 0, 'automation_id');
108
+ if (action === 'delete') {
109
+ await requireConsent(context, flag(input, 'yes'), `Deleting automation ${id} removes it and its firing history for good.`);
110
+ const result = await unwrap(await client.DELETE('/v1/automations/{automation_id}', automationPath(id)));
111
+ return context.output.result(result, `Deleted automation ${id}.`);
112
+ }
113
+ if (action === 'run') {
114
+ const firing = await unwrap(await client.POST('/v1/automations/{automation_id}/run', automationPath(id)));
115
+ return context.output.result(firing, `Fired ${firing.id}: ${firing.status}${firing.run_id === null ? '' : `, run ${firing.run_id} in session ${firing.session_id ?? '-'}`}.`);
116
+ }
117
+ const automation = await unwrap(action === 'pause'
118
+ ? await client.POST('/v1/automations/{automation_id}/pause', automationPath(id))
119
+ : await client.POST('/v1/automations/{automation_id}/resume', automationPath(id)));
120
+ context.output.result(automation, `Automation ${id} is ${automation.status}.`);
121
+ },
122
+ };
123
+ }
124
+ const firings = {
125
+ arguments: '<automation_id>',
126
+ options: PAGE_OPTIONS,
127
+ path: ['cloud', 'automations', 'firings'],
128
+ summary: "List an automation's firings, newest first, with each run's status.",
129
+ async run(context, input) {
130
+ const page = await unwrap(await (await context.client()).GET('/v1/automations/{automation_id}/firings', {
131
+ params: {
132
+ path: { automation_id: argument(input, 0, 'automation_id') },
133
+ query: pageQuery(input),
134
+ },
135
+ }));
136
+ context.output.list(page, [
137
+ { header: 'id', value: (firing) => firing.id },
138
+ { header: 'source', value: (firing) => firing.source },
139
+ { header: 'status', value: (firing) => firing.status },
140
+ { header: 'run', value: (firing) => firing.run_id },
141
+ { header: 'fired', value: (firing) => firing.fired_at },
142
+ ]);
143
+ },
144
+ };
145
+ const rotate = {
146
+ arguments: '<automation_id>',
147
+ options: YES_OPTION,
148
+ path: ['cloud', 'automations', 'rotate-secret'],
149
+ summary: "Replace a webhook's signing secret; the old one stops at once.",
150
+ async run(context, input) {
151
+ const id = argument(input, 0, 'automation_id');
152
+ await requireConsent(context, flag(input, 'yes'), `The webhook's current signing secret stops working at once; senders need the new one.`);
153
+ const secret = await unwrap(await (await context.client()).POST('/v1/automations/{automation_id}/webhook/rotate_secret', automationPath(id)));
154
+ context.output.result(secret, `New signing secret (shown once): ${secret.webhook_secret}`);
155
+ },
156
+ };
157
+ function fromFlags(input) {
158
+ const name = stringOption(input, 'name');
159
+ const agentId = stringOption(input, 'agent');
160
+ const message = stringOption(input, 'message');
161
+ if (name === undefined || agentId === undefined || message === undefined)
162
+ throw new UsageError('An automation needs --name, --agent and --message, or --file.');
163
+ const cron = stringOption(input, 'cron');
164
+ const at = stringOption(input, 'at');
165
+ const webhook = flag(input, 'webhook');
166
+ if ([cron !== undefined, at !== undefined, webhook].filter(Boolean).length !== 1)
167
+ throw new UsageError('Pass exactly one of --cron, --at or --webhook.');
168
+ const sessionId = stringOption(input, 'session');
169
+ return {
170
+ name,
171
+ target: {
172
+ agent_id: agentId,
173
+ message,
174
+ ...(sessionId === undefined
175
+ ? {}
176
+ : { session: { mode: 'fixed', session_id: sessionId } }),
177
+ type: 'agent',
178
+ },
179
+ trigger: webhook
180
+ ? { type: 'webhook' }
181
+ : {
182
+ schedule: cron === undefined
183
+ ? { run_at: at ?? '', type: 'once' }
184
+ : {
185
+ cron,
186
+ timezone: stringOption(input, 'timezone') ?? 'UTC',
187
+ type: 'recurring',
188
+ },
189
+ type: 'schedule',
190
+ },
191
+ };
192
+ }
193
+ /** The API validates the whole body; the CLI checks only its shape. */
194
+ function isCreateInput(value) {
195
+ return (isJsonObject(value) &&
196
+ typeof value.name === 'string' &&
197
+ isJsonObject(value.target) &&
198
+ isJsonObject(value.trigger));
199
+ }
200
+ function asCreateInput(value) {
201
+ if (!isCreateInput(value))
202
+ throw new UsageError('An automation needs name, and target and trigger objects.');
203
+ return value;
204
+ }
205
+ function isUpdateInput(value) {
206
+ return isJsonObject(value);
207
+ }
208
+ function asUpdateInput(value) {
209
+ if (!isUpdateInput(value))
210
+ throw new UsageError('The changes must be a JSON object.');
211
+ return value;
212
+ }
213
+ function describeTrigger(automation) {
214
+ const trigger = automation.trigger;
215
+ if (trigger.type === 'webhook')
216
+ return 'webhook';
217
+ return trigger.schedule.type === 'once'
218
+ ? `once ${trigger.schedule.run_at}`
219
+ : `${trigger.schedule.cron} ${trigger.schedule.timezone}`;
220
+ }
221
+ export const automationCommands = [
222
+ list,
223
+ get,
224
+ create,
225
+ update,
226
+ lifecycle('pause', "Stop an automation's schedule."),
227
+ lifecycle('resume', 'Resume a paused automation.'),
228
+ lifecycle('run', 'Fire an automation now, whatever its status.'),
229
+ lifecycle('delete', 'Delete an automation and its firing history.'),
230
+ firings,
231
+ rotate,
232
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const chatCommands: readonly Command[];
3
+ //# sourceMappingURL=chats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/chats.ts"],"names":[],"mappings":"AAIA,OAAO,EAOH,KAAK,OAAO,EAIf,MAAM,eAAe,CAAC;AAwPvB,eAAO,MAAM,YAAY,EAAE,SAAS,OAAO,EAAyB,CAAC"}
@@ -0,0 +1,189 @@
1
+ // `chat local` and `chat import`: find Claude Code and Codex chats on this machine and import them.
2
+ import { z } from 'zod';
3
+ import { flag, MissingScopeFailure, requireConsent, stringOption, UsageError, YES_OPTION, } from '../command.js';
4
+ import { findLocalChats, LOCAL_CHAT_SOURCES, toImportInput, } from '../local-chats.js';
5
+ import { queryWorkspaceTool } from './workspace.js';
6
+ const FIND_OPTIONS = {
7
+ dir: {
8
+ description: 'Read sessions from this folder (default: $CLAUDE_CONFIG_DIR/projects or ~/.claude/projects; $CODEX_HOME/sessions or ~/.codex/sessions).',
9
+ type: 'string',
10
+ valueName: 'PATH',
11
+ },
12
+ from: {
13
+ description: `Where the chats are: ${LOCAL_CHAT_SOURCES.join(' or ')}.`,
14
+ type: 'string',
15
+ valueName: 'SOURCE',
16
+ },
17
+ folder: {
18
+ description: 'Only sessions run in this folder or inside it, such as . for this repository.',
19
+ type: 'string',
20
+ valueName: 'PATH',
21
+ },
22
+ since: {
23
+ description: 'Only sessions with a turn on or after this date, such as 2026-10-01.',
24
+ type: 'string',
25
+ valueName: 'DATE',
26
+ },
27
+ };
28
+ const ImportedSchema = z.object({
29
+ session: z.object({ id: z.string() }),
30
+ status: z.enum(['already_imported', 'imported']),
31
+ url: z.string(),
32
+ });
33
+ function localQuery(input) {
34
+ const from = stringOption(input, 'from');
35
+ if (from === undefined)
36
+ throw new UsageError(`--from is required: ${LOCAL_CHAT_SOURCES.join(' or ')}.`);
37
+ const source = LOCAL_CHAT_SOURCES.find((each) => each === from);
38
+ if (source === undefined)
39
+ throw new UsageError(`--from takes ${LOCAL_CHAT_SOURCES.join(' or ')}, not ${from}.`);
40
+ const since = stringOption(input, 'since') ?? null;
41
+ if (since !== null && Number.isNaN(new Date(since).getTime()))
42
+ throw new UsageError('--since must be a date, such as 2026-10-01.');
43
+ return {
44
+ dir: stringOption(input, 'dir') ?? null,
45
+ folder: stringOption(input, 'folder') ?? null,
46
+ since,
47
+ source,
48
+ };
49
+ }
50
+ function sourceName(source) {
51
+ return source === 'claude-code' ? 'Claude Code' : 'Codex';
52
+ }
53
+ const local = {
54
+ options: FIND_OPTIONS,
55
+ path: ['chat', 'local'],
56
+ summary: 'List Claude Code or Codex chats on this machine, newest first, to pick some for chat import.',
57
+ async run(context, input) {
58
+ const chats = await findLocalChats(context.runtime, localQuery(input));
59
+ context.output.list({
60
+ data: chats.map((chat) => ({
61
+ cwd: chat.cwd,
62
+ id: chat.id,
63
+ messages: chat.messages.length,
64
+ path: chat.path,
65
+ source: chat.source,
66
+ startedAt: chat.startedAt,
67
+ title: chat.title,
68
+ updatedAt: chat.updatedAt,
69
+ })),
70
+ }, [
71
+ { header: 'id', value: (row) => row.id },
72
+ { header: 'title', value: (row) => row.title },
73
+ { header: 'messages', value: (row) => row.messages },
74
+ { header: 'updated', value: (row) => row.updatedAt },
75
+ { header: 'folder', value: (row) => row.cwd },
76
+ ]);
77
+ },
78
+ };
79
+ const importChats = {
80
+ arguments: '[session_ids...]',
81
+ options: {
82
+ ...FIND_OPTIONS,
83
+ all: { description: 'Import every session chat local lists.', type: 'boolean' },
84
+ 'dry-run': {
85
+ description: 'Send nothing; show what each import would send and what was redacted.',
86
+ type: 'boolean',
87
+ },
88
+ ...YES_OPTION,
89
+ },
90
+ path: ['chat', 'import'],
91
+ summary: 'Import Claude Code or Codex chats from this machine as your private Dexto chats, redacted here first.',
92
+ async run(context, input) {
93
+ const query = localQuery(input);
94
+ const ids = input.positionals;
95
+ const all = flag(input, 'all');
96
+ if (ids.length === 0 && !all)
97
+ throw new UsageError('Name the sessions to import, by the ids chat local lists, or pass --all.');
98
+ const found = await findLocalChats(context.runtime, query);
99
+ const planned = (all ? found : ids.map((id) => found.find((chat) => chat.id === id) ?? id)).map((chat) => plan(chat, query.source));
100
+ const sending = planned.filter((each) => each.input !== null);
101
+ if (flag(input, 'dry-run') || sending.length === 0) {
102
+ report(context, planned.map((each) => each.result));
103
+ return flag(input, 'dry-run') || planned.length === 0 ? 0 : 1;
104
+ }
105
+ const messages = sending.reduce((sum, each) => sum + (each.result.messages ?? 0), 0);
106
+ const redacted = sending.reduce((sum, each) => sum + Object.values(each.result.redactions ?? {}).reduce((one, n) => one + n, 0), 0);
107
+ await requireConsent(context, flag(input, 'yes'), `Upload ${sending.length} ${sourceName(query.source)} chat${sending.length === 1 ? '' : 's'} (${messages} messages, ${redacted} secrets redacted) as your private Dexto chats?`);
108
+ const finished = await Promise.all(planned.map(async ({ input: sent, result }) => {
109
+ if (sent === null)
110
+ return result;
111
+ try {
112
+ const imported = ImportedSchema.parse(await queryWorkspaceTool(context, 'dexto_chat_import', sent));
113
+ return {
114
+ ...result,
115
+ chatId: imported.session.id,
116
+ status: imported.status,
117
+ url: imported.url,
118
+ };
119
+ }
120
+ catch (error) {
121
+ // A missing permission fails every import alike: exit 3 with the sign-in that fixes it.
122
+ if (error instanceof MissingScopeFailure)
123
+ throw error;
124
+ return {
125
+ ...result,
126
+ reason: error instanceof Error ? error.message : 'The import failed.',
127
+ status: 'failed',
128
+ };
129
+ }
130
+ }));
131
+ report(context, finished);
132
+ return finished.some((result) => result.status === 'failed' || result.status === 'skipped')
133
+ ? 1
134
+ : 0;
135
+ },
136
+ };
137
+ /** What importing one chosen session would send, or why it can't go. */
138
+ function plan(chat, source) {
139
+ if (typeof chat === 'string')
140
+ return {
141
+ input: null,
142
+ result: {
143
+ id: chat,
144
+ reason: `No ${sourceName(source)} session with this id matches here.`,
145
+ status: 'skipped',
146
+ },
147
+ };
148
+ const prepared = toImportInput(chat);
149
+ if (prepared.kind === 'skipped')
150
+ return {
151
+ input: null,
152
+ result: { id: chat.id, reason: prepared.reason, status: 'skipped', title: chat.title },
153
+ };
154
+ return {
155
+ input: prepared.input,
156
+ result: {
157
+ id: chat.id,
158
+ messages: prepared.input.messages.length,
159
+ redactions: prepared.redactions,
160
+ status: 'ready',
161
+ title: prepared.input.title,
162
+ truncated: prepared.truncated,
163
+ },
164
+ };
165
+ }
166
+ function report(context, sessions) {
167
+ context.output.result({ sessions }, sessions
168
+ .map((session) => [
169
+ `${session.status.padEnd(16)} ${session.id}`,
170
+ session.title === undefined ? '' : ` ${session.title}`,
171
+ session.url === undefined ? '' : ` ${session.url}`,
172
+ session.reason === undefined ? '' : ` ${session.reason}`,
173
+ session.status === 'ready' ? ` ${readyLine(session)}` : '',
174
+ ].join(''))
175
+ .join('\n'));
176
+ }
177
+ function readyLine(session) {
178
+ const redactions = Object.entries(session.redactions ?? {})
179
+ .map(([kind, count]) => `${count} ${kind}`)
180
+ .join(', ');
181
+ return [
182
+ `${session.messages ?? 0} messages`,
183
+ redactions === '' ? 'nothing redacted' : `redacted ${redactions}`,
184
+ session.truncated ? `${session.truncated} cut to size` : '',
185
+ ]
186
+ .filter((part) => part !== '')
187
+ .join('; ');
188
+ }
189
+ export const chatCommands = [local, importChats];
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const dataDeletionCommands: readonly Command[];
3
+ //# sourceMappingURL=data-deletions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-deletions.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/data-deletions.ts"],"names":[],"mappings":"AAGA,OAAO,EASH,KAAK,OAAO,EACf,MAAM,eAAe,CAAC;AAiFvB,eAAO,MAAM,oBAAoB,EAAE,SAAS,OAAO,EAAwB,CAAC"}
@@ -0,0 +1,54 @@
1
+ // `cloud data-deletions`: delete an end user's or an agent's data in the background.
2
+ import { unwrap } from '@dexto/cloud-client';
3
+ import { argument, flag, PAGE_OPTIONS, pageQuery, requireConsent, stringOption, UsageError, YES_OPTION, } from '../command.js';
4
+ const COLUMNS = [
5
+ { header: 'id', value: (deletion) => deletion.id },
6
+ { header: 'status', value: (deletion) => deletion.status },
7
+ { header: 'scope', value: (deletion) => JSON.stringify(deletion.scope) },
8
+ { header: 'created', value: (deletion) => deletion.created_at },
9
+ ];
10
+ const create = {
11
+ options: {
12
+ agent: { description: 'The agent whose data to delete.', type: 'string', valueName: 'ID' },
13
+ user: { description: 'The end-user label whose sessions to delete.', type: 'string' },
14
+ ...YES_OPTION,
15
+ },
16
+ path: ['cloud', 'data-deletions', 'create'],
17
+ summary: "Delete an end user's sessions (--user, optionally of one --agent), or all of an agent's data (--agent).",
18
+ async run(context, input) {
19
+ const agentId = stringOption(input, 'agent');
20
+ const user = stringOption(input, 'user');
21
+ if (agentId === undefined && user === undefined)
22
+ throw new UsageError('Pass --user, --agent, or both.');
23
+ await requireConsent(context, flag(input, 'yes'), user === undefined
24
+ ? `This deletes all of agent ${agentId}'s data for good.`
25
+ : `This deletes ${user}'s sessions${agentId === undefined ? '' : ` with agent ${agentId}`} for good.`);
26
+ const deletion = await unwrap(await (await context.client()).POST('/v1/data_deletions', {
27
+ body: { agent_id: agentId ?? null, ...(user === undefined ? {} : { user }) },
28
+ }));
29
+ context.output.result(deletion, `Data deletion ${deletion.id} is ${deletion.status}.`);
30
+ },
31
+ };
32
+ const list = {
33
+ options: PAGE_OPTIONS,
34
+ path: ['cloud', 'data-deletions', 'list'],
35
+ summary: 'List data deletions.',
36
+ async run(context, input) {
37
+ context.output.list(await unwrap(await (await context.client()).GET('/v1/data_deletions', {
38
+ params: { query: pageQuery(input) },
39
+ })), COLUMNS);
40
+ },
41
+ };
42
+ const get = {
43
+ arguments: '<data_deletion_id>',
44
+ path: ['cloud', 'data-deletions', 'get'],
45
+ summary: 'Show a data deletion and what it deleted.',
46
+ async run(context, input) {
47
+ context.output.record(await unwrap(await (await context.client()).GET('/v1/data_deletions/{data_deletion_id}', {
48
+ params: {
49
+ path: { data_deletion_id: argument(input, 0, 'data_deletion_id') },
50
+ },
51
+ })));
52
+ },
53
+ };
54
+ export const dataDeletionCommands = [create, list, get];
@@ -0,0 +1,10 @@
1
+ import { type Command, type CommandContext } from '../command.js';
2
+ /**
3
+ * A person's sign-in needs the kind's permission, and to deploy also `cloud:write`, which the API
4
+ * checks first; asking for every missing one at once lets a single sign-in cover the command. A
5
+ * deploy spends credits, so running one is asking for `cloud:write`. At a terminal the CLI then
6
+ * offers to sign in again for them. A key's permissions are checked by the API.
7
+ */
8
+ export declare function requireLoginScopes(context: CommandContext, scopes: readonly string[]): Promise<void>;
9
+ export declare const deployCommands: readonly Command[];
10
+ //# sourceMappingURL=deploys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploys.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/deploys.ts"],"names":[],"mappings":"AAQA,OAAO,EAQH,KAAK,OAAO,EACZ,KAAK,cAAc,EAGtB,MAAM,eAAe,CAAC;AAkLvB;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACpC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,MAAM,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAYf;AAwED,eAAO,MAAM,cAAc,EAAE,SAAS,OAAO,EAM5C,CAAC"}