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
@@ -1,4 +0,0 @@
1
- export { handleLoginCommand, handleAutoLogin } from './login.js';
2
- export { handleLogoutCommand } from './logout.js';
3
- export { handleStatusCommand } from './status.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,4 +0,0 @@
1
- // packages/cli/src/cli/commands/auth/index.ts
2
- export { handleLoginCommand, handleAutoLogin } from './login.js';
3
- export { handleLogoutCommand } from './logout.js';
4
- export { handleStatusCommand } from './status.js';
@@ -1,12 +0,0 @@
1
- export interface LoginCommandOptions {
2
- apiKey?: string;
3
- token?: string;
4
- platformUrl?: string | undefined;
5
- interactive?: boolean;
6
- }
7
- export declare function handleLoginCommand(options?: LoginCommandOptions): Promise<void>;
8
- export declare function handleAutoLogin(): Promise<void>;
9
- export declare function handleDeviceLogin(options?: {
10
- platformUrl?: string;
11
- }): Promise<void>;
12
- //# sourceMappingURL=login.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAgBD,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsEzF;AAGD,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD;AAED,wBAAsB,iBAAiB,CAAC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7F"}
@@ -1,153 +0,0 @@
1
- // packages/cli/src/cli/commands/auth/login.ts
2
- import chalk from 'chalk';
3
- import * as p from '@clack/prompts';
4
- import { DEXTO_PLATFORM_URL } from '../../auth/constants.js';
5
- import { DextoApiClient, getDextoApiClient, isAuthenticated, loadAuth, performDeviceCodeLogin, persistDeviceApiKeyLoginResult, persistOAuthLoginResult, storeAuth, } from '../../auth/index.js';
6
- function isCancellationError(errorMessage) {
7
- const lower = errorMessage.toLowerCase();
8
- return (lower.includes('canceled') ||
9
- lower.includes('cancelled') ||
10
- lower.includes('user denied') ||
11
- lower.includes('user_denied') ||
12
- lower.includes('access_denied') ||
13
- lower.includes('access denied by user') ||
14
- lower.includes('device login was denied'));
15
- }
16
- // Handle login command with device code as the default flow.
17
- export async function handleLoginCommand(options = {}) {
18
- try {
19
- if (options.apiKey && options.token) {
20
- throw new Error('Cannot use both --api-key and --token. Choose one.');
21
- }
22
- if (await isAuthenticated()) {
23
- const auth = await loadAuth();
24
- const userInfo = auth?.email || auth?.userId || 'user';
25
- console.log(chalk.green(`✅ Already logged in as: ${userInfo}`));
26
- if (!options.apiKey && !options.token) {
27
- if (options.interactive === false) {
28
- return;
29
- }
30
- const shouldContinue = await p.confirm({
31
- message: 'Do you want to login with a different account?',
32
- initialValue: false,
33
- });
34
- if (p.isCancel(shouldContinue) || !shouldContinue) {
35
- return;
36
- }
37
- }
38
- }
39
- if (options.apiKey) {
40
- const client = options.platformUrl
41
- ? new DextoApiClient(options.platformUrl)
42
- : getDextoApiClient();
43
- const isValid = await client.validateDextoApiKey(options.apiKey);
44
- if (!isValid) {
45
- throw new Error('Invalid API key provided - validation failed');
46
- }
47
- await storeAuth({
48
- dextoApiKey: options.apiKey,
49
- dextoApiKeySource: 'user-supplied',
50
- dextoPlatformUrl: new URL(options.platformUrl ?? DEXTO_PLATFORM_URL).origin,
51
- createdAt: Date.now(),
52
- });
53
- console.log(chalk.green('✅ Dexto API key saved'));
54
- return;
55
- }
56
- if (options.token) {
57
- const didLogin = await handleTokenLogin(options.token);
58
- if (!didLogin) {
59
- throw new Error('Login was cancelled.');
60
- }
61
- console.log(chalk.green('🎉 Login successful!'));
62
- return;
63
- }
64
- if (options.interactive === false) {
65
- await handleDeviceLogin(options.platformUrl ? { platformUrl: options.platformUrl } : {});
66
- console.log(chalk.green('🎉 Login successful!'));
67
- return;
68
- }
69
- p.intro(chalk.inverse(' Login to Dexto '));
70
- await handleDeviceLogin(options.platformUrl ? { platformUrl: options.platformUrl } : {});
71
- p.outro(chalk.green('🎉 Login successful!'));
72
- }
73
- catch (error) {
74
- const errorMessage = error instanceof Error ? error.message : String(error);
75
- p.outro(chalk.red(`❌ Login failed: ${errorMessage}`));
76
- throw error;
77
- }
78
- }
79
- // Compatibility wrapper used by setup flow; always device login.
80
- export async function handleAutoLogin() {
81
- await handleDeviceLogin();
82
- }
83
- export async function handleDeviceLogin(options = {}) {
84
- try {
85
- const platformUrl = options.platformUrl ?? DEXTO_PLATFORM_URL;
86
- const result = await performDeviceCodeLogin({
87
- apiUrl: platformUrl,
88
- onPrompt: (prompt) => {
89
- console.log(chalk.cyan('\nUse any browser to complete login:'));
90
- if (prompt.verificationUrlComplete) {
91
- console.log(chalk.dim(` • Open: ${prompt.verificationUrlComplete}`));
92
- console.log(chalk.dim(` • If asked, code: ${prompt.userCode}`));
93
- }
94
- else {
95
- console.log(chalk.dim(` • Open: ${prompt.verificationUrl}`));
96
- console.log(chalk.dim(` • Enter code: ${prompt.userCode}`));
97
- }
98
- console.log(chalk.dim(` • Code expires in ~${Math.ceil(prompt.expiresIn / 60)} min`));
99
- },
100
- });
101
- const persisted = await persistDeviceApiKeyLoginResult(result, platformUrl);
102
- console.log(chalk.dim(`\nSaved Dexto API key ${persisted.keyId ?? ''}`.trim()));
103
- }
104
- catch (error) {
105
- const errorMessage = error instanceof Error ? error.message : String(error);
106
- if (isCancellationError(errorMessage)) {
107
- throw new Error('Login was cancelled.');
108
- }
109
- throw new Error(`Device login failed: ${errorMessage}`);
110
- }
111
- }
112
- async function handleTokenLogin(tokenInput) {
113
- let token = tokenInput?.trim();
114
- if (!token) {
115
- const promptedToken = await p.password({
116
- message: 'Enter your API token:',
117
- validate: (value) => {
118
- if (!value)
119
- return 'Token is required';
120
- if (value.length < 10)
121
- return 'Token seems too short';
122
- return undefined;
123
- },
124
- });
125
- if (p.isCancel(promptedToken)) {
126
- return false;
127
- }
128
- token = promptedToken;
129
- }
130
- if (token.length < 10) {
131
- throw new Error('Token seems too short');
132
- }
133
- const spinner = p.spinner();
134
- spinner.start('Verifying token...');
135
- try {
136
- const apiClient = getDextoApiClient();
137
- const user = await apiClient.fetchSupabaseUser(token);
138
- if (!user) {
139
- spinner.stop('Invalid token');
140
- throw new Error('Token verification failed');
141
- }
142
- spinner.stop('Token verified!');
143
- await persistOAuthLoginResult({
144
- accessToken: token,
145
- user,
146
- });
147
- return true;
148
- }
149
- catch (error) {
150
- spinner.stop('Verification failed');
151
- throw error;
152
- }
153
- }
@@ -1,5 +0,0 @@
1
- export declare function handleLogoutCommand(options?: {
2
- force?: boolean;
3
- interactive?: boolean;
4
- }): Promise<void>;
5
- //# sourceMappingURL=logout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAaA,wBAAsB,mBAAmB,CACrC,OAAO,GAAE;IACL,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACpB,GACP,OAAO,CAAC,IAAI,CAAC,CA8Ff"}
@@ -1,81 +0,0 @@
1
- // packages/cli/src/cli/commands/auth/logout.ts
2
- import chalk from 'chalk';
3
- import * as p from '@clack/prompts';
4
- import { isAuthenticated, loadAuth, removeAuth, removeDextoApiKeyFromEnv, } from '../../auth/index.js';
5
- import { isUsingDextoCredits } from '../../../config/effective-llm.js';
6
- import { logger } from '@dexto/core';
7
- export async function handleLogoutCommand(options = {}) {
8
- try {
9
- if (!(await isAuthenticated())) {
10
- console.log(chalk.yellow('ℹ️ Not currently logged in'));
11
- return;
12
- }
13
- // Check if user is configured to use Dexto credits
14
- // Uses getEffectiveLLMConfig() to check all config layers
15
- const usingDextoCredits = await isUsingDextoCredits();
16
- if (options.interactive !== false && !options.force) {
17
- p.intro(chalk.inverse(' Logout '));
18
- // Warn if using Dexto credits
19
- if (usingDextoCredits) {
20
- console.log(chalk.yellow('\n⚠️ You are currently configured to use Dexto Nova credits (provider: Dexto Nova)'));
21
- console.log(chalk.dim(' After logout, you will need to run `dexto setup` to configure'));
22
- console.log(chalk.dim(' a different provider, or `dexto login` to log back in.\n'));
23
- }
24
- const shouldLogout = await p.confirm({
25
- message: usingDextoCredits
26
- ? 'Logout will disable Dexto Nova credits. Continue?'
27
- : 'Are you sure you want to logout?',
28
- initialValue: false,
29
- });
30
- if (p.isCancel(shouldLogout) || !shouldLogout) {
31
- p.cancel('Logout cancelled');
32
- return;
33
- }
34
- }
35
- let provisionedApiKey = null;
36
- const auth = await loadAuth();
37
- if (auth?.dextoApiKey && auth.dextoApiKeySource === 'provisioned') {
38
- provisionedApiKey = auth.dextoApiKey;
39
- }
40
- let removeAuthError;
41
- try {
42
- await removeAuth();
43
- }
44
- catch (error) {
45
- removeAuthError = error;
46
- }
47
- if (provisionedApiKey) {
48
- try {
49
- await removeDextoApiKeyFromEnv({ expectedValue: provisionedApiKey });
50
- }
51
- catch (cleanupError) {
52
- if (!removeAuthError) {
53
- throw cleanupError;
54
- }
55
- logger.warn('Failed to clean up provisioned DEXTO_API_KEY after removeAuth error', {
56
- removeAuthError: removeAuthError instanceof Error
57
- ? removeAuthError.message
58
- : String(removeAuthError),
59
- cleanupError: cleanupError instanceof Error ? cleanupError.message : String(cleanupError),
60
- });
61
- }
62
- }
63
- if (removeAuthError) {
64
- throw removeAuthError;
65
- }
66
- console.log(chalk.green('✅ Successfully logged out'));
67
- if (usingDextoCredits) {
68
- console.log();
69
- console.log(chalk.cyan('Next steps:'));
70
- console.log(chalk.dim(' • Run `dexto login` to log back in'));
71
- console.log(chalk.dim(' • Or run `dexto setup` to configure a different provider'));
72
- }
73
- logger.info('User logged out');
74
- }
75
- catch (error) {
76
- const errorMessage = error instanceof Error ? error.message : String(error);
77
- console.error(chalk.red(`❌ Logout failed: ${errorMessage}`));
78
- // Re-throw to let CLI wrapper handle exit and analytics tracking
79
- throw error;
80
- }
81
- }
@@ -1,3 +0,0 @@
1
- import type { RuntimeCommandRegisterContext } from '../register-context.js';
2
- export declare function registerAuthCommand({ program }: RuntimeCommandRegisterContext): void;
3
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,6BAA6B,GAAG,IAAI,CAsHpF"}
@@ -1,96 +0,0 @@
1
- import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
2
- export function registerAuthCommand({ program }) {
3
- const authCommand = program.command('auth').description('Manage authentication');
4
- authCommand
5
- .command('login')
6
- .description('Login to Dexto')
7
- .option('--api-key <key>', 'Use Dexto API key instead of device-code login')
8
- .option('--token <token>', 'Use an existing Supabase access token')
9
- .option('--platform-url <url>', 'Use a custom Dexto platform URL for device-code login')
10
- .option('--no-interactive', 'Disable interactive prompts')
11
- .action(withAnalytics('auth login', async (options) => {
12
- try {
13
- const { handleLoginCommand } = await import('./login.js');
14
- await handleLoginCommand(options);
15
- safeExit('auth login', 0);
16
- }
17
- catch (err) {
18
- if (err instanceof ExitSignal)
19
- throw err;
20
- console.error(`❌ dexto auth login command failed: ${err}`);
21
- safeExit('auth login', 1, 'error');
22
- }
23
- }));
24
- authCommand
25
- .command('logout')
26
- .description('Logout from Dexto')
27
- .option('--force', 'Skip confirmation prompt')
28
- .option('--no-interactive', 'Disable interactive prompts')
29
- .action(withAnalytics('auth logout', async (options) => {
30
- try {
31
- const { handleLogoutCommand } = await import('./logout.js');
32
- await handleLogoutCommand(options);
33
- safeExit('auth logout', 0);
34
- }
35
- catch (err) {
36
- if (err instanceof ExitSignal)
37
- throw err;
38
- console.error(`❌ dexto auth logout command failed: ${err}`);
39
- safeExit('auth logout', 1, 'error');
40
- }
41
- }));
42
- authCommand
43
- .command('status')
44
- .description('Show authentication status')
45
- .action(withAnalytics('auth status', async () => {
46
- try {
47
- const { handleStatusCommand } = await import('./status.js');
48
- await handleStatusCommand();
49
- safeExit('auth status', 0);
50
- }
51
- catch (err) {
52
- if (err instanceof ExitSignal)
53
- throw err;
54
- console.error(`❌ dexto auth status command failed: ${err}`);
55
- safeExit('auth status', 1, 'error');
56
- }
57
- }));
58
- program
59
- .command('login')
60
- .description('Login to Dexto (alias for `dexto auth login`)')
61
- .option('--api-key <key>', 'Use Dexto API key instead of device-code login')
62
- .option('--token <token>', 'Use an existing Supabase access token')
63
- .option('--platform-url <url>', 'Use a custom Dexto platform URL for device-code login')
64
- .option('--no-interactive', 'Disable interactive prompts')
65
- .action(withAnalytics('login', async (options) => {
66
- try {
67
- const { handleLoginCommand } = await import('./login.js');
68
- await handleLoginCommand(options);
69
- safeExit('login', 0);
70
- }
71
- catch (err) {
72
- if (err instanceof ExitSignal)
73
- throw err;
74
- console.error(`❌ dexto login command failed: ${err}`);
75
- safeExit('login', 1, 'error');
76
- }
77
- }));
78
- program
79
- .command('logout')
80
- .description('Logout from Dexto (alias for `dexto auth logout`)')
81
- .option('--force', 'Skip confirmation prompt')
82
- .option('--no-interactive', 'Disable interactive prompts')
83
- .action(withAnalytics('logout', async (options) => {
84
- try {
85
- const { handleLogoutCommand } = await import('./logout.js');
86
- await handleLogoutCommand(options);
87
- safeExit('logout', 0);
88
- }
89
- catch (err) {
90
- if (err instanceof ExitSignal)
91
- throw err;
92
- console.error(`❌ dexto logout command failed: ${err}`);
93
- safeExit('logout', 1, 'error');
94
- }
95
- }));
96
- }
@@ -1,2 +0,0 @@
1
- export declare function handleStatusCommand(): Promise<void>;
2
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/status.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBzD"}
@@ -1,22 +0,0 @@
1
- // packages/cli/src/cli/commands/auth/status.ts
2
- import chalk from 'chalk';
3
- import { loadAuth } from '../../auth/index.js';
4
- export async function handleStatusCommand() {
5
- const auth = await loadAuth();
6
- if (!auth) {
7
- console.log(chalk.yellow('❌ Not logged in'));
8
- console.log(chalk.dim('Run `dexto login` to authenticate'));
9
- return;
10
- }
11
- console.log(chalk.green('✅ Logged in'));
12
- if (auth.email) {
13
- console.log(chalk.dim(`Email: ${auth.email}`));
14
- }
15
- if (auth.userId) {
16
- console.log(chalk.dim(`User ID: ${auth.userId}`));
17
- }
18
- if (auth.expiresAt) {
19
- const expiresDate = new Date(auth.expiresAt);
20
- console.log(chalk.dim(`Expires: ${expiresDate.toLocaleDateString()}`));
21
- }
22
- }
@@ -1,2 +0,0 @@
1
- export { handleBillingStatusCommand } from './status.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/billing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
@@ -1,2 +0,0 @@
1
- // packages/cli/src/cli/commands/billing/index.ts
2
- export { handleBillingStatusCommand } from './status.js';
@@ -1,3 +0,0 @@
1
- import type { RuntimeCommandRegisterContext } from '../register-context.js';
2
- export declare function registerBillingCommand({ program }: RuntimeCommandRegisterContext): void;
3
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/billing/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,EAAE,6BAA6B,GAAG,IAAI,CAkBvF"}
@@ -1,20 +0,0 @@
1
- import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
2
- export function registerBillingCommand({ program }) {
3
- program
4
- .command('billing')
5
- .description('Show billing status and credit balance')
6
- .option('--buy', 'Open Dexto Nova credits purchase page')
7
- .action(withAnalytics('billing', async (options) => {
8
- try {
9
- const { handleBillingStatusCommand } = await import('./status.js');
10
- await handleBillingStatusCommand(options);
11
- safeExit('billing', 0);
12
- }
13
- catch (err) {
14
- if (err instanceof ExitSignal)
15
- throw err;
16
- console.error(`❌ dexto billing command failed: ${err}`);
17
- safeExit('billing', 1, 'error');
18
- }
19
- }));
20
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Handle the `dexto billing` command.
3
- * Shows Dexto account billing information including balance and usage.
4
- */
5
- export declare function handleBillingStatusCommand(options?: {
6
- buy?: boolean;
7
- }): Promise<void>;
8
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/billing/status.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAmE/F"}
@@ -1,71 +0,0 @@
1
- // packages/cli/src/cli/commands/billing/status.ts
2
- import chalk from 'chalk';
3
- import { loadAuth, getDextoApiClient, openDextoBillingPage } from '../../auth/index.js';
4
- import { DEXTO_CREDITS_URL } from '../../auth/constants.js';
5
- /**
6
- * Handle the `dexto billing` command.
7
- * Shows Dexto account billing information including balance and usage.
8
- */
9
- export async function handleBillingStatusCommand(options = {}) {
10
- const auth = await loadAuth();
11
- if (!auth) {
12
- console.log(chalk.yellow('❌ Not logged in to Dexto'));
13
- console.log(chalk.dim('Run `dexto login` to authenticate'));
14
- if (options.buy) {
15
- await openCreditsPage();
16
- }
17
- return;
18
- }
19
- if (!auth.dextoApiKey) {
20
- console.log(chalk.yellow('❌ No Dexto API key found'));
21
- console.log(chalk.dim('Run `dexto login` to provision an API key'));
22
- if (options.buy) {
23
- await openCreditsPage();
24
- }
25
- return;
26
- }
27
- console.log(chalk.green('✅ Logged in to Dexto'));
28
- if (auth.email) {
29
- console.log(chalk.dim(`Account: ${auth.email}`));
30
- }
31
- console.log();
32
- try {
33
- const apiClient = getDextoApiClient();
34
- const usage = await apiClient.getUsageSummary(auth.dextoApiKey);
35
- // Display balance
36
- console.log(chalk.cyan('💰 Balance'));
37
- console.log(` ${chalk.bold('$' + usage.balance_usd.toFixed(2))} remaining`);
38
- console.log(chalk.dim(` Buy more credits: run ${chalk.cyan('dexto billing --buy')}`));
39
- console.log();
40
- console.log(chalk.cyan('📊 Last 30 Days'));
41
- console.log(` Spent: ${chalk.yellow('$' + usage.last_30_days.total_cost_usd.toFixed(4))}`);
42
- console.log(` Usage events: ${chalk.yellow(usage.last_30_days.total_usage_events.toString())}`);
43
- // Show recent usage if any
44
- if (usage.recent_model_usage.length > 0) {
45
- console.log();
46
- console.log(chalk.cyan('🕐 Recent Activity'));
47
- for (const entry of usage.recent_model_usage.slice(0, 5)) {
48
- const date = new Date(entry.timestamp).toLocaleString();
49
- console.log(` ${chalk.dim(date)} - ${entry.model}: $${entry.cost_usd.toFixed(4)}`);
50
- }
51
- }
52
- }
53
- catch (error) {
54
- const errorMessage = error instanceof Error ? error.message : String(error);
55
- console.log(chalk.red(`❌ Failed to fetch billing info: ${errorMessage}`));
56
- console.log(chalk.dim('Try again shortly. If your API key is invalid, run `dexto login`.'));
57
- }
58
- if (options.buy) {
59
- await openCreditsPage();
60
- }
61
- }
62
- async function openCreditsPage() {
63
- try {
64
- await openDextoBillingPage({});
65
- }
66
- catch (error) {
67
- const errorMessage = error instanceof Error ? error.message : String(error);
68
- console.log(chalk.yellow(`⚠️ Unable to open browser: ${errorMessage}`));
69
- console.log(chalk.dim(`Open this link to buy credits: ${DEXTO_CREDITS_URL}`));
70
- }
71
- }
@@ -1,17 +0,0 @@
1
- export type CloudDiscoveryCommand = {
2
- command: 'sources';
3
- } | {
4
- command: 'search';
5
- query: string;
6
- } | {
7
- command: 'describe';
8
- path: string;
9
- };
10
- export interface CloudDiscoveryOptions {
11
- json?: boolean;
12
- limit?: string;
13
- offset?: string;
14
- platformUrl?: string;
15
- }
16
- export declare function runCloudDiscovery(command: CloudDiscoveryCommand, options: CloudDiscoveryOptions): Promise<number>;
17
- //# sourceMappingURL=discovery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cloud/discovery.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAC3B;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5C,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,qBAAqB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAyGjB"}
@@ -1,88 +0,0 @@
1
- import { CloudClientError, createDextoCloudClient } from '@dexto/client-sdk/cloud';
2
- import { ZodError } from 'zod';
3
- import { DEFAULT_DEXTO_PLATFORM_URL } from '../../auth/constants.js';
4
- import { getIncomingEnvironmentVariable } from '../../../utils/env.js';
5
- import { loadAuth } from '../../auth/service.js';
6
- export async function runCloudDiscovery(command, options) {
7
- try {
8
- const environmentToken = getIncomingEnvironmentVariable('DEXTO_API_KEY')?.trim();
9
- const environmentOrigin = getIncomingEnvironmentVariable('DEXTO_PLATFORM_URL') || undefined;
10
- const requestedOrigin = options.platformUrl ?? environmentOrigin ?? DEFAULT_DEXTO_PLATFORM_URL;
11
- const hasOriginOverride = options.platformUrl !== undefined || environmentOrigin !== undefined;
12
- const auth = await loadAuth();
13
- const savedToken = auth?.dextoApiKey?.trim();
14
- const token = environmentToken || savedToken;
15
- if (!token)
16
- throw new CloudClientError('configuration_error', 'Run dexto login or supply DEXTO_API_KEY to discover Cloud capabilities.');
17
- let origin = requestedOrigin;
18
- if (savedToken === token) {
19
- const credentialOrigin = auth?.dextoPlatformUrl;
20
- if (!credentialOrigin) {
21
- throw new CloudClientError('configuration_error', 'Saved credential has no platform origin. Run dexto login --platform-url <application-origin> again before discovering Cloud capabilities.');
22
- }
23
- if (hasOriginOverride && new URL(origin).origin !== new URL(credentialOrigin).origin) {
24
- throw new CloudClientError('configuration_error', 'Saved credential belongs to a different platform origin. Login to the requested platform or supply a different DEXTO_API_KEY issued by it.');
25
- }
26
- origin = credentialOrigin;
27
- }
28
- const client = createDextoCloudClient({ origin, token, fetch: globalThis.fetch });
29
- const pagination = {
30
- ...(options.limit === undefined ? {} : { limit: Number(options.limit) }),
31
- ...(options.offset === undefined ? {} : { offset: Number(options.offset) }),
32
- };
33
- switch (command.command) {
34
- case 'sources': {
35
- const result = await client.sources(pagination);
36
- console.log(options.json
37
- ? JSON.stringify(result)
38
- : result.sources
39
- .map((source) => `${source.id}\t${source.title}\t${source.kind}${source.toolCount === undefined ? '' : `\t${source.toolCount} tools`}`)
40
- .join('\n') || 'No capability sources available.');
41
- break;
42
- }
43
- case 'search': {
44
- const result = await client.search({ ...pagination, query: command.query });
45
- const rows = result.items.map((tool) => `${tool.aliases.join(', ') || tool.name}\t${tool.description}\t${tool.invocable.mode}`);
46
- console.log(options.json
47
- ? JSON.stringify(result)
48
- : [
49
- ...rows,
50
- `${result.total} matches${result.nextOffset === null ? '' : `; next page: --offset ${result.nextOffset}`}`,
51
- ].join('\n'));
52
- break;
53
- }
54
- case 'describe': {
55
- const result = await client.describe(command.path);
56
- console.log(options.json
57
- ? JSON.stringify(result)
58
- : result.found
59
- ? JSON.stringify(result.tool, null, 2)
60
- : `Capability ${result.path} was not found.`);
61
- break;
62
- }
63
- }
64
- return 0;
65
- }
66
- catch (error) {
67
- const failure = error instanceof CloudClientError
68
- ? {
69
- code: error.code,
70
- message: error.message,
71
- ...(error.status === undefined ? {} : { status: error.status }),
72
- }
73
- : error instanceof ZodError
74
- ? {
75
- code: 'invalid_input',
76
- message: 'Check the query, capability path, and pagination (limit 1–100; offset 0 or greater).',
77
- }
78
- : {
79
- code: 'cloud_discovery_error',
80
- message: 'Cloud discovery failed. Check the platform origin and credential configuration.',
81
- };
82
- if (options.json)
83
- console.log(JSON.stringify({ error: failure }));
84
- else
85
- console.error(failure.message);
86
- return 1;
87
- }
88
- }