dexto 1.14.6 → 2.0.0-beta.1

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 (297) hide show
  1. package/dist/agents/coding-agent/coding-agent.yml +0 -2
  2. package/dist/cli/agent-audit.d.ts +12 -0
  3. package/dist/cli/agent-audit.d.ts.map +1 -0
  4. package/dist/cli/agent-audit.js +52 -0
  5. package/dist/cli/auth/billing.d.ts +0 -6
  6. package/dist/cli/auth/billing.d.ts.map +1 -1
  7. package/dist/cli/auth/billing.js +0 -23
  8. package/dist/cli/auth/constants.d.ts +3 -31
  9. package/dist/cli/auth/constants.d.ts.map +1 -1
  10. package/dist/cli/auth/constants.js +9 -33
  11. package/dist/cli/auth/index.d.ts +2 -9
  12. package/dist/cli/auth/index.d.ts.map +1 -1
  13. package/dist/cli/auth/index.js +2 -7
  14. package/dist/cli/auth/sign-in-runtime.d.ts +12 -0
  15. package/dist/cli/auth/sign-in-runtime.d.ts.map +1 -0
  16. package/dist/cli/auth/sign-in-runtime.js +59 -0
  17. package/dist/cli/cloud/app-scopes.d.ts +4 -0
  18. package/dist/cli/cloud/app-scopes.d.ts.map +1 -0
  19. package/dist/cli/cloud/app-scopes.js +19 -0
  20. package/dist/cli/cloud/command.d.ts +107 -0
  21. package/dist/cli/cloud/command.d.ts.map +1 -0
  22. package/dist/cli/cloud/command.js +154 -0
  23. package/dist/cli/cloud/commands/account.d.ts +11 -0
  24. package/dist/cli/cloud/commands/account.d.ts.map +1 -0
  25. package/dist/cli/cloud/commands/account.js +129 -0
  26. package/dist/cli/cloud/commands/agents.d.ts +3 -0
  27. package/dist/cli/cloud/commands/agents.d.ts.map +1 -0
  28. package/dist/cli/cloud/commands/agents.js +526 -0
  29. package/dist/cli/cloud/commands/api.d.ts +3 -0
  30. package/dist/cli/cloud/commands/api.d.ts.map +1 -0
  31. package/dist/cli/cloud/commands/api.js +26 -0
  32. package/dist/cli/cloud/commands/app-files.d.ts +29 -0
  33. package/dist/cli/cloud/commands/app-files.d.ts.map +1 -0
  34. package/dist/cli/cloud/commands/app-files.js +72 -0
  35. package/dist/cli/cloud/commands/artifacts.d.ts +3 -0
  36. package/dist/cli/cloud/commands/artifacts.d.ts.map +1 -0
  37. package/dist/cli/cloud/commands/artifacts.js +267 -0
  38. package/dist/cli/cloud/commands/automations.d.ts +3 -0
  39. package/dist/cli/cloud/commands/automations.d.ts.map +1 -0
  40. package/dist/cli/cloud/commands/automations.js +233 -0
  41. package/dist/cli/cloud/commands/chats.d.ts +3 -0
  42. package/dist/cli/cloud/commands/chats.d.ts.map +1 -0
  43. package/dist/cli/cloud/commands/chats.js +204 -0
  44. package/dist/cli/cloud/commands/data-deletions.d.ts +3 -0
  45. package/dist/cli/cloud/commands/data-deletions.d.ts.map +1 -0
  46. package/dist/cli/cloud/commands/data-deletions.js +55 -0
  47. package/dist/cli/cloud/commands/deploys.d.ts +10 -0
  48. package/dist/cli/cloud/commands/deploys.d.ts.map +1 -0
  49. package/dist/cli/cloud/commands/deploys.js +225 -0
  50. package/dist/cli/cloud/commands/drive.d.ts +12 -0
  51. package/dist/cli/cloud/commands/drive.d.ts.map +1 -0
  52. package/dist/cli/cloud/commands/drive.js +321 -0
  53. package/dist/cli/cloud/commands/files.d.ts +24 -0
  54. package/dist/cli/cloud/commands/files.d.ts.map +1 -0
  55. package/dist/cli/cloud/commands/files.js +284 -0
  56. package/dist/cli/cloud/commands/find.d.ts +3 -0
  57. package/dist/cli/cloud/commands/find.d.ts.map +1 -0
  58. package/dist/cli/cloud/commands/find.js +63 -0
  59. package/dist/cli/cloud/commands/models.d.ts +3 -0
  60. package/dist/cli/cloud/commands/models.d.ts.map +1 -0
  61. package/dist/cli/cloud/commands/models.js +250 -0
  62. package/dist/cli/cloud/commands/profile.d.ts +3 -0
  63. package/dist/cli/cloud/commands/profile.d.ts.map +1 -0
  64. package/dist/cli/cloud/commands/profile.js +120 -0
  65. package/dist/cli/cloud/commands/projects.d.ts +5 -0
  66. package/dist/cli/cloud/commands/projects.d.ts.map +1 -0
  67. package/dist/cli/cloud/commands/projects.js +66 -0
  68. package/dist/cli/cloud/commands/publish.d.ts +3 -0
  69. package/dist/cli/cloud/commands/publish.d.ts.map +1 -0
  70. package/dist/cli/cloud/commands/publish.js +139 -0
  71. package/dist/cli/cloud/commands/sandboxes.d.ts +3 -0
  72. package/dist/cli/cloud/commands/sandboxes.d.ts.map +1 -0
  73. package/dist/cli/cloud/commands/sandboxes.js +266 -0
  74. package/dist/cli/cloud/commands/secrets.d.ts +3 -0
  75. package/dist/cli/cloud/commands/secrets.d.ts.map +1 -0
  76. package/dist/cli/cloud/commands/secrets.js +111 -0
  77. package/dist/cli/cloud/commands/skills.d.ts +3 -0
  78. package/dist/cli/cloud/commands/skills.d.ts.map +1 -0
  79. package/dist/cli/cloud/commands/skills.js +203 -0
  80. package/dist/cli/cloud/commands/traces.d.ts +3 -0
  81. package/dist/cli/cloud/commands/traces.d.ts.map +1 -0
  82. package/dist/cli/cloud/commands/traces.js +142 -0
  83. package/dist/cli/cloud/commands/web.d.ts +3 -0
  84. package/dist/cli/cloud/commands/web.d.ts.map +1 -0
  85. package/dist/cli/cloud/commands/web.js +53 -0
  86. package/dist/cli/cloud/commands/workspace-apps.d.ts +58 -0
  87. package/dist/cli/cloud/commands/workspace-apps.d.ts.map +1 -0
  88. package/dist/cli/cloud/commands/workspace-apps.js +657 -0
  89. package/dist/cli/cloud/commands/workspace.d.ts +36 -0
  90. package/dist/cli/cloud/commands/workspace.d.ts.map +1 -0
  91. package/dist/cli/cloud/commands/workspace.js +281 -0
  92. package/dist/cli/cloud/connection.d.ts +33 -0
  93. package/dist/cli/cloud/connection.d.ts.map +1 -0
  94. package/dist/cli/cloud/connection.js +38 -0
  95. package/dist/cli/cloud/events.d.ts +63 -0
  96. package/dist/cli/cloud/events.d.ts.map +1 -0
  97. package/dist/cli/cloud/events.js +72 -0
  98. package/dist/cli/cloud/host.d.ts +9 -0
  99. package/dist/cli/cloud/host.d.ts.map +1 -0
  100. package/dist/cli/cloud/host.js +109 -0
  101. package/dist/cli/cloud/output.d.ts +34 -0
  102. package/dist/cli/cloud/output.d.ts.map +1 -0
  103. package/dist/cli/cloud/output.js +77 -0
  104. package/dist/cli/cloud/run.d.ts +26 -0
  105. package/dist/cli/cloud/run.d.ts.map +1 -0
  106. package/dist/cli/cloud/run.js +444 -0
  107. package/dist/cli/cloud/runtime.d.ts +33 -0
  108. package/dist/cli/cloud/runtime.d.ts.map +1 -0
  109. package/dist/cli/cloud/runtime.js +86 -0
  110. package/dist/cli/cloud/tar.d.ts +9 -0
  111. package/dist/cli/cloud/tar.d.ts.map +1 -0
  112. package/dist/cli/cloud/tar.js +69 -0
  113. package/dist/cli/cloud/transfer.d.ts +13 -0
  114. package/dist/cli/cloud/transfer.d.ts.map +1 -0
  115. package/dist/cli/cloud/transfer.js +36 -0
  116. package/dist/cli/cloud/v1.d.ts +20 -0
  117. package/dist/cli/cloud/v1.d.ts.map +1 -0
  118. package/dist/cli/cloud/v1.js +66 -0
  119. package/dist/cli/cloud/zip.d.ts +8 -0
  120. package/dist/cli/cloud/zip.d.ts.map +1 -0
  121. package/dist/cli/cloud/zip.js +66 -0
  122. package/dist/cli/commands/auth/sign-in-commands.d.ts +62 -0
  123. package/dist/cli/commands/auth/sign-in-commands.d.ts.map +1 -0
  124. package/dist/cli/commands/auth/sign-in-commands.js +248 -0
  125. package/dist/cli/commands/auth/sign-in-context.d.ts +16 -0
  126. package/dist/cli/commands/auth/sign-in-context.d.ts.map +1 -0
  127. package/dist/cli/commands/auth/sign-in-context.js +68 -0
  128. package/dist/cli/commands/cloud/register.d.ts +5 -0
  129. package/dist/cli/commands/cloud/register.d.ts.map +1 -1
  130. package/dist/cli/commands/cloud/register.js +44 -24
  131. package/dist/cli/commands/create-app.js +5 -6
  132. package/dist/cli/commands/create-image.d.ts.map +1 -1
  133. package/dist/cli/commands/create-image.js +9 -10
  134. package/dist/cli/commands/index.d.ts +0 -2
  135. package/dist/cli/commands/index.d.ts.map +1 -1
  136. package/dist/cli/commands/index.js +0 -2
  137. package/dist/cli/commands/init.d.ts +0 -2
  138. package/dist/cli/commands/init.d.ts.map +1 -1
  139. package/dist/cli/commands/init.js +5 -26
  140. package/dist/cli/commands/run/headless.d.ts.map +1 -1
  141. package/dist/cli/commands/run/headless.js +57 -2
  142. package/dist/cli/commands/run/output.d.ts +29 -10
  143. package/dist/cli/commands/run/output.d.ts.map +1 -1
  144. package/dist/cli/commands/run/output.js +44 -22
  145. package/dist/cli/commands/run/register.d.ts.map +1 -1
  146. package/dist/cli/commands/run/register.js +21 -9
  147. package/dist/cli/commands/run/step-log.d.ts +11 -0
  148. package/dist/cli/commands/run/step-log.d.ts.map +1 -0
  149. package/dist/cli/commands/run/step-log.js +42 -0
  150. package/dist/cli/commands/session/register.d.ts.map +1 -1
  151. package/dist/cli/commands/session/register.js +51 -21
  152. package/dist/cli/commands/session-commands.js +1 -1
  153. package/dist/cli/commands/setup.js +17 -14
  154. package/dist/cli/failure.d.ts +29 -0
  155. package/dist/cli/failure.d.ts.map +1 -0
  156. package/dist/cli/failure.js +31 -0
  157. package/dist/cli/help-json.d.ts +22 -0
  158. package/dist/cli/help-json.d.ts.map +1 -0
  159. package/dist/cli/help-json.js +20 -0
  160. package/dist/cli/import/claude-code.d.ts +10 -0
  161. package/dist/cli/import/claude-code.d.ts.map +1 -0
  162. package/dist/cli/import/claude-code.js +131 -0
  163. package/dist/cli/import/codex.d.ts +27 -0
  164. package/dist/cli/import/codex.d.ts.map +1 -0
  165. package/dist/cli/import/codex.js +148 -0
  166. package/dist/cli/import/git.d.ts +19 -0
  167. package/dist/cli/import/git.d.ts.map +1 -0
  168. package/dist/cli/import/git.js +95 -0
  169. package/dist/cli/import/local-chats.d.ts +28 -0
  170. package/dist/cli/import/local-chats.d.ts.map +1 -0
  171. package/dist/cli/import/local-chats.js +129 -0
  172. package/dist/cli/import/redaction.d.ts +37 -0
  173. package/dist/cli/import/redaction.d.ts.map +1 -0
  174. package/dist/cli/import/redaction.js +148 -0
  175. package/dist/cli/import/test-utils.d.ts +16 -0
  176. package/dist/cli/import/test-utils.d.ts.map +1 -0
  177. package/dist/cli/import/test-utils.js +223 -0
  178. package/dist/cli/import/transcript.d.ts +75 -0
  179. package/dist/cli/import/transcript.d.ts.map +1 -0
  180. package/dist/cli/import/transcript.js +123 -0
  181. package/dist/cli/interaction.d.ts +18 -0
  182. package/dist/cli/interaction.d.ts.map +1 -0
  183. package/dist/cli/interaction.js +30 -0
  184. package/dist/cli/modes/cli.d.ts.map +1 -1
  185. package/dist/cli/modes/cli.js +42 -9
  186. package/dist/cli/modes/server.js +8 -8
  187. package/dist/cli/modes/web.js +3 -3
  188. package/dist/cli/output.d.ts +9 -0
  189. package/dist/cli/output.d.ts.map +1 -0
  190. package/dist/cli/output.js +6 -0
  191. package/dist/cli/utils/dexto-auth-check.d.ts +1 -1
  192. package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -1
  193. package/dist/cli/utils/dexto-auth-check.js +4 -5
  194. package/dist/cli/utils/dexto-setup.d.ts +4 -5
  195. package/dist/cli/utils/dexto-setup.d.ts.map +1 -1
  196. package/dist/cli/utils/dexto-setup.js +17 -14
  197. package/dist/cli/utils/provider-setup.js +1 -1
  198. package/dist/cli/utils/scaffolding-utils.d.ts +9 -3
  199. package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
  200. package/dist/cli/utils/scaffolding-utils.js +48 -40
  201. package/dist/cli/utils/version-check.d.ts.map +1 -1
  202. package/dist/cli/utils/version-check.js +2 -1
  203. package/dist/index-main.js +44 -65
  204. package/dist/webui/assets/index-D9xiOs62.js +1649 -0
  205. package/dist/webui/index.html +1 -1
  206. package/package.json +15 -14
  207. package/dist/cli/auth/api-client.d.ts +0 -125
  208. package/dist/cli/auth/api-client.d.ts.map +0 -1
  209. package/dist/cli/auth/api-client.js +0 -585
  210. package/dist/cli/auth/device.d.ts +0 -14
  211. package/dist/cli/auth/device.d.ts.map +0 -1
  212. package/dist/cli/auth/device.js +0 -84
  213. package/dist/cli/auth/dexto-api-key.d.ts +0 -34
  214. package/dist/cli/auth/dexto-api-key.d.ts.map +0 -1
  215. package/dist/cli/auth/dexto-api-key.js +0 -160
  216. package/dist/cli/auth/login-persistence.d.ts +0 -15
  217. package/dist/cli/auth/login-persistence.d.ts.map +0 -1
  218. package/dist/cli/auth/login-persistence.js +0 -72
  219. package/dist/cli/auth/oauth.d.ts +0 -39
  220. package/dist/cli/auth/oauth.d.ts.map +0 -1
  221. package/dist/cli/auth/oauth.js +0 -434
  222. package/dist/cli/auth/service.d.ts +0 -24
  223. package/dist/cli/auth/service.d.ts.map +0 -1
  224. package/dist/cli/auth/service.js +0 -161
  225. package/dist/cli/auth/types.d.ts +0 -11
  226. package/dist/cli/auth/types.d.ts.map +0 -1
  227. package/dist/cli/auth/types.js +0 -1
  228. package/dist/cli/cloud-chat.d.ts +0 -18
  229. package/dist/cli/cloud-chat.d.ts.map +0 -1
  230. package/dist/cli/cloud-chat.js +0 -734
  231. package/dist/cli/commands/auth/index.d.ts +0 -4
  232. package/dist/cli/commands/auth/index.d.ts.map +0 -1
  233. package/dist/cli/commands/auth/index.js +0 -4
  234. package/dist/cli/commands/auth/login.d.ts +0 -12
  235. package/dist/cli/commands/auth/login.d.ts.map +0 -1
  236. package/dist/cli/commands/auth/login.js +0 -153
  237. package/dist/cli/commands/auth/logout.d.ts +0 -5
  238. package/dist/cli/commands/auth/logout.d.ts.map +0 -1
  239. package/dist/cli/commands/auth/logout.js +0 -81
  240. package/dist/cli/commands/auth/register.d.ts +0 -3
  241. package/dist/cli/commands/auth/register.d.ts.map +0 -1
  242. package/dist/cli/commands/auth/register.js +0 -96
  243. package/dist/cli/commands/auth/status.d.ts +0 -2
  244. package/dist/cli/commands/auth/status.d.ts.map +0 -1
  245. package/dist/cli/commands/auth/status.js +0 -22
  246. package/dist/cli/commands/billing/index.d.ts +0 -2
  247. package/dist/cli/commands/billing/index.d.ts.map +0 -1
  248. package/dist/cli/commands/billing/index.js +0 -2
  249. package/dist/cli/commands/billing/register.d.ts +0 -3
  250. package/dist/cli/commands/billing/register.d.ts.map +0 -1
  251. package/dist/cli/commands/billing/register.js +0 -20
  252. package/dist/cli/commands/billing/status.d.ts +0 -8
  253. package/dist/cli/commands/billing/status.d.ts.map +0 -1
  254. package/dist/cli/commands/billing/status.js +0 -71
  255. package/dist/cli/commands/cloud/discovery.d.ts +0 -17
  256. package/dist/cli/commands/cloud/discovery.d.ts.map +0 -1
  257. package/dist/cli/commands/cloud/discovery.js +0 -88
  258. package/dist/cli/commands/deploy/client.d.ts +0 -113
  259. package/dist/cli/commands/deploy/client.d.ts.map +0 -1
  260. package/dist/cli/commands/deploy/client.js +0 -519
  261. package/dist/cli/commands/deploy/config.d.ts +0 -37
  262. package/dist/cli/commands/deploy/config.d.ts.map +0 -1
  263. package/dist/cli/commands/deploy/config.js +0 -144
  264. package/dist/cli/commands/deploy/entry-agent.d.ts +0 -3
  265. package/dist/cli/commands/deploy/entry-agent.d.ts.map +0 -1
  266. package/dist/cli/commands/deploy/entry-agent.js +0 -70
  267. package/dist/cli/commands/deploy/index.d.ts +0 -12
  268. package/dist/cli/commands/deploy/index.d.ts.map +0 -1
  269. package/dist/cli/commands/deploy/index.js +0 -370
  270. package/dist/cli/commands/deploy/links.d.ts +0 -3
  271. package/dist/cli/commands/deploy/links.d.ts.map +0 -1
  272. package/dist/cli/commands/deploy/links.js +0 -53
  273. package/dist/cli/commands/deploy/register.d.ts +0 -6
  274. package/dist/cli/commands/deploy/register.d.ts.map +0 -1
  275. package/dist/cli/commands/deploy/register.js +0 -128
  276. package/dist/cli/commands/deploy/snapshot.d.ts +0 -12
  277. package/dist/cli/commands/deploy/snapshot.d.ts.map +0 -1
  278. package/dist/cli/commands/deploy/snapshot.js +0 -76
  279. package/dist/cli/commands/deploy/state.d.ts +0 -13
  280. package/dist/cli/commands/deploy/state.d.ts.map +0 -1
  281. package/dist/cli/commands/deploy/state.js +0 -122
  282. package/dist/cli/commands/span/register.d.ts +0 -6
  283. package/dist/cli/commands/span/register.d.ts.map +0 -1
  284. package/dist/cli/commands/span/register.js +0 -25
  285. package/dist/cli/commands/trace/client.d.ts +0 -98
  286. package/dist/cli/commands/trace/client.d.ts.map +0 -1
  287. package/dist/cli/commands/trace/client.js +0 -150
  288. package/dist/cli/commands/trace/format.d.ts +0 -5
  289. package/dist/cli/commands/trace/format.d.ts.map +0 -1
  290. package/dist/cli/commands/trace/format.js +0 -58
  291. package/dist/cli/commands/trace/index.d.ts +0 -21
  292. package/dist/cli/commands/trace/index.d.ts.map +0 -1
  293. package/dist/cli/commands/trace/index.js +0 -49
  294. package/dist/cli/commands/trace/register.d.ts +0 -6
  295. package/dist/cli/commands/trace/register.d.ts.map +0 -1
  296. package/dist/cli/commands/trace/register.js +0 -71
  297. package/dist/webui/assets/index-DEfRFmFT.js +0 -1667
@@ -0,0 +1,63 @@
1
+ // `find`: what to run for something you want to do, from Dexto's search, as commands.
2
+ import { integerOption, isJsonObject, UsageError } from '../command.js';
3
+ import { commandForCall } from './workspace-apps.js';
4
+ import { listWorkspaceTools, queryWorkspaceTool } from './workspace.js';
5
+ const find = {
6
+ arguments: '<what...>',
7
+ options: {
8
+ limit: {
9
+ description: 'How many to show (default 5, up to 8).',
10
+ type: 'string',
11
+ valueName: 'N',
12
+ },
13
+ },
14
+ path: ['find'],
15
+ summary: "Find what to run for something you want to do: Dexto's operations, apps, skills, agents and more, each as a command.",
16
+ async run(context, input) {
17
+ const query = input.positionals.join(' ').trim();
18
+ if (query.length < 2)
19
+ throw new UsageError('Say what you want to do, such as: dexto find "share a file".');
20
+ const limit = integerOption(input, 'limit');
21
+ const page = await queryWorkspaceTool(context, 'dexto_search', {
22
+ query,
23
+ ...(limit === undefined ? {} : { limit }),
24
+ });
25
+ const results = isJsonObject(page) && Array.isArray(page.results)
26
+ ? page.results.filter(isJsonObject)
27
+ : [];
28
+ const tools = await listWorkspaceTools(context);
29
+ const operationsByApp = new Map();
30
+ const found = [];
31
+ for (const result of results) {
32
+ const call = isJsonObject(result.call) && typeof result.call.tool === 'string'
33
+ ? {
34
+ arguments: isJsonObject(result.call.arguments)
35
+ ? result.call.arguments
36
+ : {},
37
+ tool: result.call.tool,
38
+ }
39
+ : null;
40
+ found.push({
41
+ availability: String(result.availability ?? ''),
42
+ command: call === null
43
+ ? null
44
+ : await commandForCall(context, tools, call, operationsByApp),
45
+ kind: String(result.sourceKind ?? ''),
46
+ next_step: String(result.nextStep ?? ''),
47
+ summary: String(result.summary ?? ''),
48
+ title: String(result.title ?? ''),
49
+ });
50
+ }
51
+ if (context.output.json)
52
+ return context.output.list({ data: found }, []);
53
+ if (found.length === 0) {
54
+ context.runtime.writeOutput('Nothing found. Try other words, or run dexto workspace for your apps.\n');
55
+ return;
56
+ }
57
+ context.runtime.writeOutput(found
58
+ .map((each, index) => `${index + 1}. ${each.title} (${each.kind})\n ${each.command ?? each.next_step}\n`)
59
+ .join(''));
60
+ context.output.note('Fill in each <value>, and run a command with --help for its input.');
61
+ },
62
+ };
63
+ export const findCommands = [find];
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const modelCommands: readonly Command[];
3
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/models.ts"],"names":[],"mappings":"AAOA,OAAO,EAUH,KAAK,OAAO,EAGf,MAAM,eAAe,CAAC;AA4UvB,eAAO,MAAM,aAAa,EAAE,SAAS,OAAO,EAAmC,CAAC"}
@@ -0,0 +1,250 @@
1
+ // `cloud models`: every model call, text or media, as a model id and its input.
2
+ import { CommandFailure } from '../../failure.js';
3
+ import { requireConsent } from '../../interaction.js';
4
+ import { randomUUID } from 'node:crypto';
5
+ import { unwrap } from '@dexto/cloud-client';
6
+ import { argument, BODY_OPTIONS, flag, isJsonObject, PAGE_OPTIONS, pageQuery, readJsonBody, stringOption, UsageError, } from '../command.js';
7
+ const KINDS = ['text', 'image', 'video', 'audio', 'file'];
8
+ const MODEL_COLUMNS = [
9
+ { header: 'id', value: (model) => model.id },
10
+ { header: 'kind', value: (model) => model.kind },
11
+ { header: 'title', value: (model) => ('media' in model ? model.media.title : model.text.name) },
12
+ { header: 'price', value: (model) => price(model) },
13
+ ];
14
+ const RUN_COLUMNS = [
15
+ { header: 'id', value: (run) => run.id },
16
+ { header: 'model', value: (run) => run.model },
17
+ { header: 'kind', value: (run) => run.media_kind },
18
+ { header: 'status', value: (run) => run.status },
19
+ { header: 'created', value: (run) => run.created_at },
20
+ ];
21
+ const list = {
22
+ options: {
23
+ for: {
24
+ description: 'Recommend media models for what you want to make.',
25
+ type: 'string',
26
+ valueName: 'INTENT',
27
+ },
28
+ type: {
29
+ description: `Only models of this kind: ${KINDS.join(', ')}.`,
30
+ type: 'string',
31
+ valueName: 'KIND',
32
+ },
33
+ },
34
+ path: ['cloud', 'models', 'list'],
35
+ summary: 'List the models you can run, text and media, with their prices.',
36
+ async run(context, input) {
37
+ const type = stringOption(input, 'type');
38
+ if (type !== undefined && !KINDS.some((kind) => kind === type))
39
+ throw new UsageError(`--type must be one of ${KINDS.join(', ')}.`);
40
+ const intent = stringOption(input, 'for');
41
+ const client = await context.client();
42
+ const models = intent === undefined
43
+ ? await catalog(client, type === undefined ? 'both' : type === 'text' ? 'text' : 'media')
44
+ : (await unwrap(await client.GET('/v1/media/recommendations', {
45
+ params: { query: { intent } },
46
+ }))).data.map(mediaModel);
47
+ context.output.list({ data: models.filter((model) => type === undefined || model.kind === type) }, MODEL_COLUMNS);
48
+ },
49
+ };
50
+ const get = {
51
+ arguments: '<model>',
52
+ path: ['cloud', 'models', 'get'],
53
+ summary: 'Show a model: its kind, price, and what it takes.',
54
+ async run(context, input) {
55
+ const model = await findModel(await context.client(), argument(input, 0, 'model'));
56
+ if (context.output.json)
57
+ return context.output.record('media' in model ? model.media : model.text);
58
+ if (!('media' in model)) {
59
+ const capabilities = model.text.capabilities;
60
+ const longContext = model.text.pricing?.contextOver200kPerM ?? null;
61
+ return context.output.record({
62
+ id: model.id,
63
+ kind: model.kind,
64
+ price: price(model),
65
+ ...(longContext === null
66
+ ? {}
67
+ : {
68
+ long_prompt_price: `$${longContext.inputPerM} in / $${longContext.outputPerM} out per 1M tokens above ${longContext.inputTokensAbove} input tokens`,
69
+ }),
70
+ context_tokens: capabilities.maxInputTokens,
71
+ input: capabilities.input.join(', '),
72
+ output: capabilities.output.join(', '),
73
+ reasoning: capabilities.reasoning,
74
+ tools: capabilities.supportsToolCall,
75
+ });
76
+ }
77
+ const required = new Set(model.media.input.required);
78
+ context.output.record({
79
+ id: model.id,
80
+ kind: model.kind,
81
+ title: model.media.title,
82
+ description: model.media.description,
83
+ price: price(model),
84
+ input: model.media.input.fields
85
+ .map((field) => `${field.name}${required.has(field.name) ? '*' : ''} (${field.type})`)
86
+ .join(', '),
87
+ });
88
+ },
89
+ };
90
+ const run = {
91
+ arguments: '<model> [prompt...]',
92
+ options: {
93
+ ...BODY_OPTIONS,
94
+ 'no-wait': {
95
+ description: 'Start a media run and print its id instead of waiting for it.',
96
+ type: 'boolean',
97
+ },
98
+ overwrite: {
99
+ description: 'With --save-to, replace a file already there.',
100
+ type: 'boolean',
101
+ },
102
+ 'save-to': {
103
+ description: "Keep a media run's outputs as project files: a path, or a prefix ending in /.",
104
+ type: 'string',
105
+ valueName: 'PATH',
106
+ },
107
+ system: { description: 'A system prompt, for a text model.', type: 'string' },
108
+ yes: {
109
+ description: 'Run a media model without confirming its estimated price. Pass it only once your person has agreed.',
110
+ type: 'boolean',
111
+ },
112
+ },
113
+ path: ['cloud', 'models', 'run'],
114
+ summary: 'Run any model. A text model replies to the prompt (or stdin); a media model is priced, confirmed, then run.',
115
+ async run(context, input) {
116
+ const client = await context.client();
117
+ const model = await findModel(client, argument(input, 0, 'model'));
118
+ const prompt = input.positionals.slice(1).join(' ').trim();
119
+ return 'media' in model
120
+ ? await runMedia(context, input, client, model.id, prompt)
121
+ : await runText(context, input, client, model.id, prompt);
122
+ },
123
+ };
124
+ const runs = {
125
+ options: PAGE_OPTIONS,
126
+ path: ['cloud', 'models', 'runs', 'list'],
127
+ summary: 'List recent media runs in the Cloud project.',
128
+ async run(context, input) {
129
+ context.output.list(await unwrap(await (await context.client()).GET('/v1/media/generations', {
130
+ params: { query: pageQuery(input) },
131
+ })), RUN_COLUMNS);
132
+ },
133
+ };
134
+ const runGet = {
135
+ arguments: '<run_id>',
136
+ path: ['cloud', 'models', 'runs', 'get'],
137
+ summary: 'Show a media run, its status and its outputs.',
138
+ async run(context, input) {
139
+ context.output.record(await getRun(await context.client(), argument(input, 0, 'run_id')));
140
+ },
141
+ };
142
+ async function getRun(client, id) {
143
+ return await unwrap(await client.GET('/v1/media/generations/{generation_id}', {
144
+ params: { path: { generation_id: id } },
145
+ }));
146
+ }
147
+ async function runText(context, input, client, model, argumentPrompt) {
148
+ if (stringOption(input, 'data') !== undefined || stringOption(input, 'file') !== undefined)
149
+ throw new UsageError(`${model} is a text model: give it a prompt, not --data or --file.`);
150
+ // A prompt piped in, such as a file to summarise, when none is given as arguments.
151
+ const prompt = argumentPrompt.length > 0 || context.runtime.prompt !== null
152
+ ? argumentPrompt
153
+ : (await context.runtime.readStdin()).trim();
154
+ if (prompt.length === 0)
155
+ throw new UsageError('Give the prompt as arguments, or pipe it on stdin.');
156
+ const system = stringOption(input, 'system');
157
+ const response = await unwrap(await client.POST('/v1/chat/completions', {
158
+ body: {
159
+ model,
160
+ messages: [
161
+ ...(system === undefined ? [] : [{ role: 'system', content: system }]),
162
+ { role: 'user', content: prompt },
163
+ ],
164
+ },
165
+ }));
166
+ if (context.output.jsonContent)
167
+ return context.output.record(response);
168
+ // The operation also answers as a stream; without `stream` it is always the JSON reply.
169
+ if (typeof response !== 'object' || response === null || !('choices' in response))
170
+ throw new CommandFailure('failed', `${model} answered without a reply.`, null);
171
+ const content = response.choices[0]?.message.content;
172
+ context.runtime.writeOutput(`${typeof content === 'string' ? content : JSON.stringify(content ?? null)}\n`);
173
+ }
174
+ async function runMedia(context, input, client, model, prompt) {
175
+ if (stringOption(input, 'system') !== undefined)
176
+ throw new UsageError(`${model} is a media model: --system is for text models.`);
177
+ const body = await readJsonBody(context, input);
178
+ if (body !== null && !isJsonObject(body))
179
+ throw new UsageError("The model's input must be a JSON object.");
180
+ const modelInput = {
181
+ ...(isJsonObject(body) ? body : {}),
182
+ ...(prompt.length === 0 ? {} : { prompt }),
183
+ };
184
+ if (Object.keys(modelInput).length === 0)
185
+ throw new UsageError("Give the model's input as a prompt, --data or --file.");
186
+ const estimate = await unwrap(await client.POST('/v1/media/estimates', { body: { input: modelInput, model } }));
187
+ context.output.note(`Estimated $${estimate.amount_usd} (${estimate.confidence}): ${estimate.explanation}`);
188
+ await requireConsent(context, flag(input, 'yes'), `Running ${model} spends about $${estimate.amount_usd} of credits.`);
189
+ const saveTo = stringOption(input, 'save-to');
190
+ let generation = await unwrap(await client.POST('/v1/media/generations', {
191
+ params: { header: { 'Idempotency-Key': randomUUID() } },
192
+ body: {
193
+ estimate_id: estimate.id,
194
+ ...(saveTo === undefined
195
+ ? {}
196
+ : { overwrite: flag(input, 'overwrite'), save_to: saveTo }),
197
+ },
198
+ }));
199
+ if (flag(input, 'no-wait'))
200
+ return context.output.result(generation, `Started run ${generation.id}. Check it with dexto cloud models runs get ${generation.id}.`);
201
+ while (!generation.completed) {
202
+ await context.runtime.sleep(2000);
203
+ generation = await getRun(client, generation.id);
204
+ }
205
+ if (generation.error !== null)
206
+ throw new CommandFailure('failed', `Run ${generation.id} failed: ${generation.error.message}`, null);
207
+ if (context.output.json)
208
+ return context.output.record(generation);
209
+ context.runtime.writeOutput(`Run ${generation.id} ${generation.status}.\n`);
210
+ for (const resource of generation.resources)
211
+ context.runtime.writeOutput(`${resource.file_path ?? resource.filename ?? resource.id}${resource.url === null ? '' : ` ${resource.url}`}\n`);
212
+ }
213
+ /** The text catalog, the media catalog, or both (text first), as one list. */
214
+ async function catalog(client, which) {
215
+ const [text, media] = await Promise.all([
216
+ which === 'media' ? null : unwrap(await client.GET('/v1/models')),
217
+ which === 'text' ? null : unwrap(await client.GET('/v1/media/models')),
218
+ ]);
219
+ return [
220
+ ...(text?.data ?? []).map((model) => ({
221
+ id: model.id,
222
+ kind: 'text',
223
+ text: model,
224
+ })),
225
+ ...(media?.data ?? []).map(mediaModel),
226
+ ];
227
+ }
228
+ async function findModel(client, id) {
229
+ const model = (await catalog(client, 'both')).find((each) => each.id === id);
230
+ if (model === undefined)
231
+ throw new UsageError(`Unknown model ${id}. List them with dexto cloud models list.`);
232
+ return model;
233
+ }
234
+ function mediaModel(model) {
235
+ return { id: model.id, kind: model.media_kind, media: model };
236
+ }
237
+ function price(model) {
238
+ if (!('media' in model)) {
239
+ const pricing = model.text.pricing;
240
+ if (pricing === null)
241
+ return '-';
242
+ const base = `$${pricing.inputPerM} in / $${pricing.outputPerM} out per 1M tokens`;
243
+ return pricing.contextOver200kPerM === null ? base : `${base}, more for long prompts`;
244
+ }
245
+ const pricing = model.media.pricing;
246
+ return pricing.unit_price_usd === undefined
247
+ ? pricing.estimate_mode
248
+ : `$${pricing.unit_price_usd}/${pricing.unit}`;
249
+ }
250
+ export const modelCommands = [list, get, run, runs, runGet];
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const profileCommands: readonly Command[];
3
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/profile.ts"],"names":[],"mappings":"AAMA,OAAO,EAA4B,KAAK,OAAO,EAAuB,MAAM,eAAe,CAAC;AAqI5F,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EAAkB,CAAC"}
@@ -0,0 +1,120 @@
1
+ // `profile`: read and change your own Dexto profile, as Settings → Profile does.
2
+ import { CommandFailure } from '../../failure.js';
3
+ import { z } from 'zod';
4
+ import { stringOption, UsageError } from '../command.js';
5
+ import { queryWorkspaceTool } from './workspace.js';
6
+ const ProfileSchema = z.object({
7
+ bio: z.string().nullable(),
8
+ displayName: z.string(),
9
+ handle: z.string(),
10
+ links: z.array(z.unknown()),
11
+ showTokenUsage: z.boolean(),
12
+ visibility: z.enum(['private', 'public']),
13
+ workEntries: z.array(z.unknown()),
14
+ });
15
+ const get = {
16
+ path: ['profile', 'get'],
17
+ summary: 'Show your Dexto profile: handle, name, bio, links, work and whether it is public.',
18
+ async run(context) {
19
+ const profile = await readProfile(context, 'dexto_profile_get', {});
20
+ context.output.result({ profile }, describeProfile(profile));
21
+ },
22
+ };
23
+ const update = {
24
+ options: {
25
+ bio: {
26
+ description: 'Your bio; "" clears it.',
27
+ type: 'string',
28
+ valueName: 'TEXT',
29
+ },
30
+ 'display-name': { description: 'Your display name.', type: 'string', valueName: 'NAME' },
31
+ handle: {
32
+ description: 'Your handle, unique across Dexto: 3 to 30 lowercase letters, digits and hyphens.',
33
+ type: 'string',
34
+ valueName: 'HANDLE',
35
+ },
36
+ links: {
37
+ description: 'Your links, replacing them all, as JSON: [{"kind":"github","url":"https://…"}] or {"kind":"custom","label":"…","url":"…"} entries.',
38
+ type: 'string',
39
+ valueName: 'JSON',
40
+ },
41
+ 'token-usage': {
42
+ description: 'Whether your profile shows your token usage: show or hide.',
43
+ type: 'string',
44
+ valueName: 'show|hide',
45
+ },
46
+ visibility: {
47
+ description: 'private, or public for anyone with the link.',
48
+ type: 'string',
49
+ valueName: 'private|public',
50
+ },
51
+ work: {
52
+ description: 'Your work entries, replacing them all, as JSON: {"kind":"site","siteId":"…"} or {"kind":"external","title":"…","url":"…","description":null,"imageUrl":null} entries.',
53
+ type: 'string',
54
+ valueName: 'JSON',
55
+ },
56
+ },
57
+ path: ['profile', 'update'],
58
+ summary: 'Change your Dexto profile: only the fields you pass change, such as --handle shaun --visibility public.',
59
+ async run(context, input) {
60
+ const changes = profileChanges(input);
61
+ if (Object.keys(changes).length === 0)
62
+ throw new UsageError('Pass at least one field to change, such as --handle or --visibility.');
63
+ const profile = await readProfile(context, 'dexto_profile_update', changes);
64
+ context.output.result({ profile }, `Updated.\n${describeProfile(profile)}`);
65
+ },
66
+ };
67
+ /** What `profile update` asks to change, in `dexto_profile_update`'s fields. */
68
+ function profileChanges(input) {
69
+ const visibility = stringOption(input, 'visibility');
70
+ if (visibility !== undefined && visibility !== 'private' && visibility !== 'public')
71
+ throw new UsageError('--visibility must be private or public.');
72
+ const tokenUsage = stringOption(input, 'token-usage');
73
+ if (tokenUsage !== undefined && tokenUsage !== 'show' && tokenUsage !== 'hide')
74
+ throw new UsageError('--token-usage must be show or hide.');
75
+ const bio = stringOption(input, 'bio');
76
+ const displayName = stringOption(input, 'display-name');
77
+ const handle = stringOption(input, 'handle');
78
+ const links = jsonListOption(input, 'links');
79
+ const work = jsonListOption(input, 'work');
80
+ return {
81
+ ...(bio === undefined ? {} : { bio: bio.trim().length === 0 ? null : bio }),
82
+ ...(displayName === undefined ? {} : { displayName }),
83
+ ...(handle === undefined ? {} : { handle }),
84
+ ...(links === undefined ? {} : { links }),
85
+ ...(tokenUsage === undefined ? {} : { showTokenUsage: tokenUsage === 'show' }),
86
+ ...(visibility === undefined ? {} : { visibility }),
87
+ ...(work === undefined ? {} : { workEntries: work }),
88
+ };
89
+ }
90
+ /** A JSON list option: every link or work entry at once, replacing what is there. */
91
+ function jsonListOption(input, name) {
92
+ const value = stringOption(input, name);
93
+ if (value === undefined)
94
+ return undefined;
95
+ let parsed;
96
+ try {
97
+ parsed = JSON.parse(value);
98
+ }
99
+ catch {
100
+ throw new UsageError(`--${name} must be a JSON list.`);
101
+ }
102
+ if (!Array.isArray(parsed))
103
+ throw new UsageError(`--${name} must be a JSON list.`);
104
+ return parsed;
105
+ }
106
+ async function readProfile(context, tool, input) {
107
+ const value = await queryWorkspaceTool(context, tool, input);
108
+ const parsed = z.object({ profile: ProfileSchema }).safeParse(value);
109
+ if (!parsed.success)
110
+ throw new CommandFailure('failed', "Dexto didn't return your profile.", null);
111
+ return parsed.data.profile;
112
+ }
113
+ function describeProfile(profile) {
114
+ return [
115
+ `@${profile.handle} (${profile.displayName}), ${profile.visibility}`,
116
+ ...(profile.bio === null ? [] : [profile.bio]),
117
+ `${profile.links.length} links, ${profile.workEntries.length} work entries, token usage ${profile.showTokenUsage ? 'shown' : 'hidden'}`,
118
+ ].join('\n');
119
+ }
120
+ export const profileCommands = [get, update];
@@ -0,0 +1,5 @@
1
+ import { type Command } from '../command.js';
2
+ /** Chooses the project a person's sign-in acts in; `accounts` reads the same saved login. */
3
+ export declare function projectsUse(accountsDir: string): Command;
4
+ export declare const projectCommands: readonly Command[];
5
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/projects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,OAAO,EAAuB,MAAM,eAAe,CAAC;AA8CxF,6FAA6F;AAC7F,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAkCxD;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EAAmB,CAAC"}
@@ -0,0 +1,66 @@
1
+ // `cloud projects`: the Cloud projects you can act in, and which one commands use.
2
+ import { dextoAccounts } from '@dexto/agent-management';
3
+ import { unwrap } from '@dexto/cloud-client';
4
+ import { argument, UsageError } from '../command.js';
5
+ async function listProjects(context) {
6
+ return await unwrap(await (await context.client()).GET('/v1/projects'));
7
+ }
8
+ const list = {
9
+ path: ['cloud', 'projects', 'list'],
10
+ summary: 'List the Cloud projects you can act in; * marks the current one.',
11
+ async run(context) {
12
+ const connection = await context.connection();
13
+ const projects = await listProjects(context);
14
+ context.output.list(projects, [
15
+ {
16
+ header: '',
17
+ value: (project) => project.id === connection.cloudProject ||
18
+ (connection.kind === 'api_key' && projects.data.length === 1)
19
+ ? '*'
20
+ : '',
21
+ },
22
+ { header: 'id', value: (project) => project.id },
23
+ { header: 'name', value: (project) => project.name },
24
+ { header: 'default', value: (project) => (project.is_default ? 'yes' : '') },
25
+ { header: 'archived', value: (project) => project.archived_at },
26
+ ]);
27
+ },
28
+ };
29
+ const create = {
30
+ arguments: '<name>',
31
+ path: ['cloud', 'projects', 'create'],
32
+ summary: 'Create a Cloud project. Owners and Admins create projects.',
33
+ async run(context, input) {
34
+ const project = await unwrap(await (await context.client()).POST('/v1/projects', { body: { name: argument(input, 0, 'name') } }));
35
+ context.output.result(project, `Created Cloud project ${project.name} (${project.id}). Act in it with dexto cloud projects use ${project.id}.`);
36
+ },
37
+ };
38
+ /** Chooses the project a person's sign-in acts in; `accounts` reads the same saved login. */
39
+ export function projectsUse(accountsDir) {
40
+ return {
41
+ arguments: '<project>',
42
+ path: ['cloud', 'projects', 'use'],
43
+ summary: 'Act in this Cloud project, by id or name, from now on. Dexto models bill it too.',
44
+ async run(context, input) {
45
+ const connection = await context.connection();
46
+ if (connection.kind !== 'oauth' || connection.source !== 'login')
47
+ throw new UsageError('A key acts only in its own project. Sign in with dexto login to choose projects.');
48
+ const wanted = argument(input, 0, 'project');
49
+ const projects = await listProjects(context);
50
+ const matches = projects.data.filter((project) => project.id === wanted || project.name === wanted);
51
+ const [project] = matches;
52
+ if (project === undefined)
53
+ throw new UsageError(`No Cloud project ${wanted}.`);
54
+ if (matches.length > 1)
55
+ throw new UsageError(`More than one project is named ${wanted}; use its id.`);
56
+ if (project.archived_at !== null)
57
+ throw new UsageError(`${project.name} is archived. Restore it in the Cloud app first.`);
58
+ await dextoAccounts.writeLogin(accountsDir, connection.profile, {
59
+ ...connection.login,
60
+ cloudProject: { id: project.id, name: project.name },
61
+ });
62
+ context.output.result(project, `Acting in Cloud project ${project.name} (${project.id}).`);
63
+ },
64
+ };
65
+ }
66
+ export const projectCommands = [list, create];
@@ -0,0 +1,3 @@
1
+ import { type Command } from '../command.js';
2
+ export declare const publishCommands: readonly Command[];
3
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloud/commands/publish.ts"],"names":[],"mappings":"AAUA,OAAO,EAAwD,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAiKnG,eAAO,MAAM,eAAe,EAAE,SAAS,OAAO,EAAc,CAAC"}