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
@@ -8,8 +8,6 @@ import path from 'node:path';
8
8
  import { z } from 'zod';
9
9
  import { ExitSignal, safeExit, withAnalytics } from '../../analytics/wrapper.js';
10
10
  import { getEffectiveLLMConfig } from '../../config/effective-llm.js';
11
- import { getDeployConfigPath, isWorkspaceDeployAgent, loadDeployConfig } from './deploy/config.js';
12
- import { discoverPrimaryWorkspaceAgent } from './deploy/entry-agent.js';
13
11
  import { confirmOrExit, multiselectOrExit, selectOrExit, textOrExit, } from '../utils/prompt-helpers.js';
14
12
  import { ensureImageImporterConfigured } from '../utils/image-importer.js';
15
13
  const AGENTS_FILENAME = 'AGENTS.md';
@@ -34,7 +32,7 @@ This workspace can define project-specific agents and skills.
34
32
 
35
33
  ## Defaults
36
34
  - If no workspace agent is defined, Dexto uses your global default agent locally
37
- - Cloud deploys without a workspace agent use the managed cloud default agent
35
+ - Deploy Sites and Functions with \`dexto cloud sites deploy\` and \`dexto cloud functions deploy\`
38
36
  `;
39
37
  const CORE_AGENT_TOOL_ENTRIES = [
40
38
  {
@@ -1335,18 +1333,8 @@ async function listWorkspaceSkillIds(workspaceRoot) {
1335
1333
  .map((skill) => skill.name)
1336
1334
  .sort((left, right) => left.localeCompare(right));
1337
1335
  }
1338
- function describeEffectiveDeployAgent(input) {
1339
- if (input.deployConfig) {
1340
- const configuredAgent = isWorkspaceDeployAgent(input.deployConfig.agent)
1341
- ? `workspace agent (${input.deployConfig.agent.path})`
1342
- : 'default cloud agent';
1343
- return `${configuredAgent} via ${input.deployConfigPath ?? '.dexto/deploy.json'}`;
1344
- }
1345
- if (input.implicitWorkspaceAgent) {
1346
- return `workspace agent (${input.implicitWorkspaceAgent}) if you run \`dexto deploy\``;
1347
- }
1348
- return 'default cloud agent if you run `dexto deploy`';
1349
- }
1336
+ /** Where deploys went: 1.x's workspace deploy is gone in 2.0. */
1337
+ const DEPLOY_SUMMARY = 'dexto cloud sites deploy or dexto cloud functions deploy (dexto deploy is gone in 2.0)';
1350
1338
  export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
1351
1339
  const root = path.resolve(workspaceRoot);
1352
1340
  await ensureWorkspaceRoot(root);
@@ -1365,9 +1353,6 @@ export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
1365
1353
  }))
1366
1354
  .sort((left, right) => left.id.localeCompare(right.id)) ?? [];
1367
1355
  const skills = await listWorkspaceSkillIds(root);
1368
- const deployConfigPath = getDeployConfigPath(root);
1369
- const deployConfig = await loadDeployConfig(root);
1370
- const implicitWorkspaceAgent = await discoverPrimaryWorkspaceAgent(root);
1371
1356
  return {
1372
1357
  workspaceRoot: root,
1373
1358
  agentsFilePresent,
@@ -1378,12 +1363,6 @@ export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
1378
1363
  allowGlobalAgents: registry ? registry.allowGlobalAgents : null,
1379
1364
  agents,
1380
1365
  skills,
1381
- deployConfigPath: deployConfig ? deployConfigPath : null,
1382
- effectiveDeploySummary: describeEffectiveDeployAgent({
1383
- deployConfigPath: deployConfig ? deployConfigPath : null,
1384
- deployConfig,
1385
- implicitWorkspaceAgent,
1386
- }),
1387
1366
  };
1388
1367
  }
1389
1368
  function formatWorkspaceStatus(result) {
@@ -1397,7 +1376,7 @@ function formatWorkspaceStatus(result) {
1397
1376
  `Allow global agents: ${result.allowGlobalAgents === null
1398
1377
  ? 'n/a (no workspace registry)'
1399
1378
  : String(result.allowGlobalAgents)}`,
1400
- `Deploy: ${result.effectiveDeploySummary}`,
1379
+ `Deploy: ${DEPLOY_SUMMARY}`,
1401
1380
  '',
1402
1381
  'Agents:',
1403
1382
  ...(result.agents.length > 0
@@ -1601,7 +1580,7 @@ Examples:
1601
1580
  }));
1602
1581
  initCommand
1603
1582
  .command('status')
1604
- .description('Show the current workspace configuration and deploy preview')
1583
+ .description('Show the current workspace configuration')
1605
1584
  .action(withAnalytics('init status', async () => {
1606
1585
  try {
1607
1586
  await handleInitStatusCommand();
@@ -1 +1 @@
1
- {"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/headless.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,UAAU,EAIlB,MAAM,aAAa,CAAC;AAErB,OAAO,EAGH,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;AAWrB,MAAM,MAAM,iBAAiB,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,gBAAgB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACjD,CAAC;AA0IF,wBAAsB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY/E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAgC/D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC5C,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAgBP;AAED,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,oBAA6B,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAmI5B;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAM1F;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAExD"}
1
+ {"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/headless.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,UAAU,EAIlB,MAAM,aAAa,CAAC;AAErB,OAAO,EAGH,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;AAarB,MAAM,MAAM,iBAAiB,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,gBAAgB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACjD,CAAC;AA+IF,wBAAsB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY/E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CA2C/D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC5C,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAqBP;AAED,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,oBAA6B,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAkK5B;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAc1F;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAExD"}
@@ -1,5 +1,7 @@
1
1
  import { isTextPart, safeStringify, } from '@dexto/core';
2
2
  import { writeHeadlessEvent, toHeadlessApprovalRequired, } from './output.js';
3
+ import { finishedToolStep } from '@dexto/tui/tool-step';
4
+ import { logLine, startLine, stepLine, stepLogEnabled } from './step-log.js';
3
5
  const HEADLESS_TOOL_OUTPUT_MAX_LINES = 20;
4
6
  const HEADLESS_SECTION_SEPARATOR = '========================================';
5
7
  function writeHeadlessLine(line = '') {
@@ -9,6 +11,11 @@ function writeHeadlessSeparator() {
9
11
  writeHeadlessLine(HEADLESS_SECTION_SEPARATOR);
10
12
  }
11
13
  function writeHeadlessTaggedLine(tag, message) {
14
+ if (stepLogEnabled()) {
15
+ const error = tag === 'ERROR';
16
+ writeHeadlessLine(logLine(tag.toLowerCase(), message, { error }));
17
+ return;
18
+ }
12
19
  writeHeadlessLine(`[${tag}] ${message}`);
13
20
  }
14
21
  function writeHeadlessTaggedBlock(tag, content) {
@@ -123,6 +130,16 @@ export async function resolveHeadlessPrompt(promptArg) {
123
130
  }
124
131
  export function printHeadlessMcpStartup(agent) {
125
132
  const serverStatuses = agent.getMcpServersWithStatus().filter((server) => server.enabled);
133
+ if (stepLogEnabled()) {
134
+ for (const server of serverStatuses) {
135
+ if (server.status === 'connected')
136
+ continue;
137
+ writeHeadlessLine(logLine('mcp', `${server.name} failed: ${server.error ?? server.status}`, {
138
+ error: true,
139
+ }));
140
+ }
141
+ return;
142
+ }
126
143
  if (serverStatuses.length === 0) {
127
144
  writeHeadlessTaggedLine('MCP', 'startup: no servers');
128
145
  return;
@@ -151,6 +168,10 @@ export function printHeadlessMcpStartup(agent) {
151
168
  export function printHeadlessRunSummary(params) {
152
169
  const { agent, sessionId, prompt, agentPath, cliVersion } = params;
153
170
  const llmConfig = agent.getCurrentLLMConfig(sessionId);
171
+ if (stepLogEnabled()) {
172
+ writeHeadlessLine(startLine(`${llmConfig.provider}/${llmConfig.model}`, sessionId));
173
+ return;
174
+ }
154
175
  writeHeadlessSeparator();
155
176
  writeHeadlessTaggedLine('RUN', `Dexto CLI v${cliVersion}`);
156
177
  writeHeadlessSeparator();
@@ -173,13 +194,17 @@ export async function executeHeadlessRun(agent, sessionId, prompt, format = 'tex
173
194
  let fatalError;
174
195
  try {
175
196
  for await (const event of await agent.stream(prompt, sessionId)) {
176
- if (format === 'jsonl')
197
+ if (format === 'stream-json')
177
198
  await writeHeadlessEvent(event);
178
199
  switch (event.name) {
179
200
  case 'approval:request': {
180
201
  const required = toHeadlessApprovalRequired(event);
181
202
  approvalRequired.push(required);
182
- writeHeadlessTaggedLine('APPROVAL_REQUIRED', `${'toolName' in required ? required.toolName : required.approvalType}: ${required.message} (approval ${required.approvalId})`);
203
+ if (stepLogEnabled()) {
204
+ writeHeadlessLine(logLine('denied', `${'tool_name' in required ? required.tool_name : required.approval_type} · ${required.message} · approval ${required.approval_id}`, { error: false }));
205
+ break;
206
+ }
207
+ writeHeadlessTaggedLine('APPROVAL_REQUIRED', `${'tool_name' in required ? required.tool_name : required.approval_type}: ${required.message} (approval ${required.approval_id})`);
183
208
  break;
184
209
  }
185
210
  case 'llm:tool-call': {
@@ -190,6 +215,8 @@ export async function executeHeadlessRun(agent, sessionId, prompt, format = 'tex
190
215
  startedAt: Date.now(),
191
216
  };
192
217
  toolCallState.set(callKey, call);
218
+ if (stepLogEnabled())
219
+ break;
193
220
  writeHeadlessTaggedLine('TOOL', formatToolInvocationForHeadless(call.toolName, call.args));
194
221
  break;
195
222
  }
@@ -215,6 +242,27 @@ export async function executeHeadlessRun(agent, sessionId, prompt, format = 'tex
215
242
  }
216
243
  const toolName = matchedCall?.toolName ?? event.toolName;
217
244
  const args = matchedCall?.args ?? {};
245
+ if (stepLogEnabled()) {
246
+ const display = event.sanitized?.meta.display;
247
+ const { step, output } = finishedToolStep({
248
+ toolName,
249
+ args,
250
+ success: event.success,
251
+ rawResult: event.rawResult,
252
+ ...(event.error !== undefined && { error: event.error }),
253
+ ...(event.presentationSnapshot !== undefined && {
254
+ presentationSnapshot: event.presentationSnapshot,
255
+ }),
256
+ ...(display !== undefined && { display }),
257
+ });
258
+ writeHeadlessLine(stepLine(step));
259
+ for (const line of output) {
260
+ writeHeadlessLine(logLine('', line, { error: true }));
261
+ }
262
+ if (matchedCallKey)
263
+ toolCallState.delete(matchedCallKey);
264
+ break;
265
+ }
218
266
  const invocation = formatToolInvocationForHeadless(toolName, args);
219
267
  const durationText = matchedCall
220
268
  ? ` in ${formatHeadlessDuration(Date.now() - matchedCall.startedAt)}`
@@ -279,6 +327,13 @@ export async function executeHeadlessRun(agent, sessionId, prompt, format = 'tex
279
327
  return result;
280
328
  }
281
329
  export function printHeadlessAssistantResponse(message, totalTokens) {
330
+ if (stepLogEnabled()) {
331
+ const tokens = typeof totalTokens === 'number'
332
+ ? `${new Intl.NumberFormat('en-US').format(totalTokens)} tokens`
333
+ : 'finished';
334
+ writeHeadlessLine(logLine('done', tokens, { error: false }));
335
+ return;
336
+ }
282
337
  writeHeadlessSeparator();
283
338
  writeHeadlessTaggedBlock('DEXTO', message);
284
339
  if (typeof totalTokens === 'number') {
@@ -1,21 +1,40 @@
1
1
  import { ApprovalType, type ApprovalRequest, type StreamingEvent } from '@dexto/core';
2
2
  import type { HeadlessRunResult } from './headless.js';
3
- export type HeadlessOutputFormat = 'text' | 'json' | 'jsonl';
3
+ /** How `dexto run` prints: the reply as text, one JSON result, or JSON events then the result. */
4
+ export type HeadlessOutputFormat = 'text' | 'json' | 'stream-json';
5
+ /**
6
+ * --json, --stream-json or --text as given, else JSON when stdout isn't a terminal (an agent or a
7
+ * pipe reads it) and text at one; null when more than one was given.
8
+ */
9
+ export declare function chooseHeadlessOutput(options: {
10
+ json?: boolean;
11
+ streamJson?: boolean;
12
+ text?: boolean;
13
+ }, stdoutIsTerminal: boolean): HeadlessOutputFormat | null;
14
+ /**
15
+ * An approval the run asked for that no one here could give, so it was refused and the run went
16
+ * on without it: listed as the result's `permission_denials`.
17
+ */
4
18
  export type HeadlessApprovalRequired = {
5
- approvalId: string;
6
- sessionId?: string;
19
+ approval_id: string;
20
+ session_id?: string;
7
21
  message: string;
8
22
  } & ({
9
- approvalType: typeof ApprovalType.TOOL_APPROVAL;
10
- toolName: string;
11
- toolCallId: string;
23
+ approval_type: typeof ApprovalType.TOOL_APPROVAL;
24
+ tool_name: string;
25
+ tool_call_id: string;
12
26
  } | {
13
- approvalType: typeof ApprovalType.COMMAND_APPROVAL;
14
- toolName: string;
27
+ approval_type: typeof ApprovalType.COMMAND_APPROVAL;
28
+ tool_name: string;
15
29
  } | {
16
- approvalType: Exclude<ApprovalRequest['type'], typeof ApprovalType.TOOL_APPROVAL | typeof ApprovalType.COMMAND_APPROVAL>;
30
+ approval_type: Exclude<ApprovalRequest['type'], typeof ApprovalType.TOOL_APPROVAL | typeof ApprovalType.COMMAND_APPROVAL>;
17
31
  });
18
32
  export declare function toHeadlessApprovalRequired(request: ApprovalRequest): HeadlessApprovalRequired;
19
- export declare function writeHeadlessResult(format: HeadlessOutputFormat, result: HeadlessRunResult, sessionId: string | undefined): Promise<void>;
33
+ /**
34
+ * The run's one result, for --json and as --stream-json's last line. An error says its code:
35
+ * `usage` for how it was called, otherwise `failed`. JSON output also puts the error on stderr as
36
+ * the CLI's other commands do.
37
+ */
38
+ export declare function writeHeadlessResult(format: HeadlessOutputFormat, result: HeadlessRunResult, sessionId: string | undefined, errorCode?: 'usage' | 'failed'): Promise<void>;
20
39
  export declare function writeHeadlessEvent(event: StreamingEvent): Promise<void>;
21
40
  //# sourceMappingURL=output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D,MAAM,MAAM,wBAAwB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,CACE;IAAE,YAAY,EAAE,OAAO,YAAY,CAAC,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzF;IAAE,YAAY,EAAE,OAAO,YAAY,CAAC,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACxE;IACI,YAAY,EAAE,OAAO,CACjB,eAAe,CAAC,MAAM,CAAC,EACvB,OAAO,YAAY,CAAC,aAAa,GAAG,OAAO,YAAY,CAAC,gBAAgB,CAC3E,CAAC;CACL,CACN,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,wBAAwB,CAuB7F;AAED,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD7E"}
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,kGAAkG;AAClG,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EACjE,gBAAgB,EAAE,OAAO,GAC1B,oBAAoB,GAAG,IAAI,CAQ7B;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,CACE;IAAE,aAAa,EAAE,OAAO,YAAY,CAAC,aAAa,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7F;IAAE,aAAa,EAAE,OAAO,YAAY,CAAC,gBAAgB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1E;IACI,aAAa,EAAE,OAAO,CAClB,eAAe,CAAC,MAAM,CAAC,EACvB,OAAO,YAAY,CAAC,aAAa,GAAG,OAAO,YAAY,CAAC,gBAAgB,CAC3E,CAAC;CACL,CACN,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,wBAAwB,CAuB7F;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,GAAE,OAAO,GAAG,QAAmB,GACzC,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD7E"}
@@ -1,42 +1,64 @@
1
1
  import { ApprovalType } from '@dexto/core';
2
2
  import { HEADLESS_APPROVAL_MESSAGE } from '../../approval/headless-approval-handler.js';
3
+ /**
4
+ * --json, --stream-json or --text as given, else JSON when stdout isn't a terminal (an agent or a
5
+ * pipe reads it) and text at one; null when more than one was given.
6
+ */
7
+ export function chooseHeadlessOutput(options, stdoutIsTerminal) {
8
+ const chosen = [
9
+ options.json === true ? 'json' : null,
10
+ options.streamJson === true ? 'stream-json' : null,
11
+ options.text === true ? 'text' : null,
12
+ ].filter((each) => each !== null);
13
+ if (chosen.length > 1)
14
+ return null;
15
+ return chosen[0] ?? (stdoutIsTerminal ? 'text' : 'json');
16
+ }
3
17
  export function toHeadlessApprovalRequired(request) {
4
18
  const correlation = {
5
- approvalId: request.approvalId,
6
- ...(request.sessionId !== undefined ? { sessionId: request.sessionId } : {}),
19
+ approval_id: request.approvalId,
20
+ ...(request.sessionId !== undefined ? { session_id: request.sessionId } : {}),
7
21
  message: HEADLESS_APPROVAL_MESSAGE,
8
22
  };
9
23
  switch (request.type) {
10
24
  case ApprovalType.TOOL_APPROVAL:
11
25
  return {
12
26
  ...correlation,
13
- approvalType: request.type,
14
- toolName: request.metadata.toolName,
15
- toolCallId: request.metadata.toolCallId,
27
+ approval_type: request.type,
28
+ tool_name: request.metadata.toolName,
29
+ tool_call_id: request.metadata.toolCallId,
16
30
  };
17
31
  case ApprovalType.COMMAND_APPROVAL:
18
32
  return {
19
33
  ...correlation,
20
- approvalType: request.type,
21
- toolName: request.metadata.toolName,
34
+ approval_type: request.type,
35
+ tool_name: request.metadata.toolName,
22
36
  };
23
37
  default:
24
- return { ...correlation, approvalType: request.type };
38
+ return { ...correlation, approval_type: request.type };
25
39
  }
26
40
  }
27
- export async function writeHeadlessResult(format, result, sessionId) {
41
+ /**
42
+ * The run's one result, for --json and as --stream-json's last line. An error says its code:
43
+ * `usage` for how it was called, otherwise `failed`. JSON output also puts the error on stderr as
44
+ * the CLI's other commands do.
45
+ */
46
+ export async function writeHeadlessResult(format, result, sessionId, errorCode = 'failed') {
28
47
  if (format === 'text')
29
48
  return;
49
+ const error = result.fatalError
50
+ ? { code: errorCode, message: result.fatalError.message }
51
+ : null;
52
+ if (error !== null)
53
+ process.stderr.write(`${JSON.stringify({ error })}\n`);
30
54
  await writeJsonLineToStdout({
31
- version: 1,
32
- ...(format === 'json'
33
- ? { status: result.fatalError ? 'failed' : 'completed' }
34
- : { type: result.fatalError ? 'error' : 'complete' }),
35
- ...(sessionId !== undefined ? { sessionId } : {}),
55
+ type: 'result',
56
+ status: result.fatalError ? 'failed' : 'completed',
57
+ ...(sessionId !== undefined ? { session_id: sessionId } : {}),
36
58
  ...(result.finalMessage !== undefined ? { content: result.finalMessage } : {}),
37
- ...(result.totalTokens !== undefined ? { totalTokens: result.totalTokens } : {}),
38
- ...(result.fatalError ? { error: result.fatalError.message } : {}),
39
- ...(result.approvalRequired?.length ? { approvalRequired: result.approvalRequired } : {}),
59
+ ...(result.totalTokens !== undefined ? { total_tokens: result.totalTokens } : {}),
60
+ ...(error !== null ? { error } : {}),
61
+ permission_denials: result.approvalRequired ?? [],
40
62
  });
41
63
  }
42
64
  export async function writeHeadlessEvent(event) {
@@ -57,17 +79,17 @@ export async function writeHeadlessEvent(event) {
57
79
  case 'llm:tool-call':
58
80
  payload = {
59
81
  type: 'tool_call',
60
- toolName: event.toolName,
82
+ tool_name: event.toolName,
61
83
  args: event.args,
62
- ...(event.callId ? { callId: event.callId } : {}),
84
+ ...(event.callId ? { call_id: event.callId } : {}),
63
85
  };
64
86
  break;
65
87
  case 'llm:tool-result':
66
88
  payload = {
67
89
  type: 'tool_result',
68
- toolName: event.toolName,
90
+ tool_name: event.toolName,
69
91
  success: event.success,
70
- ...(event.callId ? { callId: event.callId } : {}),
92
+ ...(event.callId ? { call_id: event.callId } : {}),
71
93
  ...(!event.success && event.error ? { error: event.error } : {}),
72
94
  };
73
95
  break;
@@ -87,7 +109,7 @@ export async function writeHeadlessEvent(event) {
87
109
  default:
88
110
  return;
89
111
  }
90
- await writeJsonLineToStdout({ version: 1, ...payload });
112
+ await writeJsonLineToStdout(payload);
91
113
  }
92
114
  function writeJsonLineToStdout(payload) {
93
115
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/register.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,kBAAkB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CAoItC"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/register.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,kBAAkB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CAoJtC"}
@@ -1,6 +1,5 @@
1
- import { Option } from 'commander';
2
1
  import { handleHeadlessApproval } from '../../approval/headless-approval-handler.js';
3
- import { writeHeadlessResult } from './output.js';
2
+ import { chooseHeadlessOutput, writeHeadlessResult } from './output.js';
4
3
  import { resolveAgentPath } from '@dexto/agent-management';
5
4
  import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
6
5
  export function registerRunCommand({ program, cliVersion, bootstrapAgentFromGlobalOpts, }) {
@@ -8,29 +7,42 @@ export function registerRunCommand({ program, cliVersion, bootstrapAgentFromGlob
8
7
  .command('run [prompt]')
9
8
  .description('Run a single prompt non-interactively (headless mode)')
10
9
  .option('-m, --model <model>', 'Specify the LLM model to use for this run')
11
- .addOption(new Option('--format <format>', 'Output format')
12
- .choices(['text', 'json', 'jsonl'])
13
- .default('text'))
10
+ .option('--json', 'Print one JSON result (the default when stdout is not a terminal)')
11
+ .option('--stream-json', 'Print JSON events, one per line, ending with one result')
12
+ .option('--text', 'Print only the reply (the default at a terminal)')
14
13
  .addHelpText('after', `
15
14
  Examples:
16
15
  $ dexto run "summarize this repository"
17
16
  $ echo "fix lint errors" | dexto run
18
17
  $ dexto run - < prompt.txt
18
+ $ dexto run "list the TODOs" --stream-json
19
+
20
+ Approvals no one here can give are refused and listed in the result's permission_denials.
21
+ Exit codes: 0 done, 1 failed, 2 usage, 3 needs sign-in or permission, 4 needs confirmation,
22
+ 5 not found, 6 waiting on a person.
19
23
  `)
20
24
  .action(withAnalytics('run', async (promptArg, runOptions) => {
25
+ const format = chooseHeadlessOutput(runOptions, process.stdout.isTTY === true);
26
+ if (format === null) {
27
+ process.stderr.write('Pass --json, --stream-json or --text, only one.\n');
28
+ safeExit('run', 2, 'usage');
29
+ return;
30
+ }
21
31
  let agent;
22
32
  let sessionId;
23
33
  let result = {};
24
34
  let exitCode = 0;
25
35
  let exitReason = 'ok';
36
+ let errorCode = 'failed';
26
37
  try {
27
38
  const { executeHeadlessRun, printHeadlessAssistantResponse, printHeadlessMcpStartup, printHeadlessRunSummary, resolveHeadlessPrompt, writeFinalMessageToStdout, writeHeadlessError, } = await import('./headless.js');
28
39
  const prompt = await resolveHeadlessPrompt(promptArg);
29
40
  if (prompt.trim().length === 0) {
30
41
  writeHeadlessError('Prompt cannot be empty.');
31
42
  result = { fatalError: new Error('Prompt cannot be empty.') };
32
- exitCode = 1;
43
+ exitCode = 2;
33
44
  exitReason = 'empty-prompt';
45
+ errorCode = 'usage';
34
46
  }
35
47
  else {
36
48
  const bootstrapOptions = runOptions.model
@@ -51,11 +63,11 @@ Examples:
51
63
  cliVersion,
52
64
  });
53
65
  printHeadlessMcpStartup(agent);
54
- const runResult = await executeHeadlessRun(agent, session.id, prompt, runOptions.format);
66
+ const runResult = await executeHeadlessRun(agent, session.id, prompt, format);
55
67
  result = runResult;
56
68
  if (runResult.finalMessage !== undefined) {
57
69
  printHeadlessAssistantResponse(runResult.finalMessage, runResult.totalTokens);
58
- if (runOptions.format === 'text') {
70
+ if (format === 'text') {
59
71
  writeFinalMessageToStdout(runResult.finalMessage);
60
72
  }
61
73
  }
@@ -96,7 +108,7 @@ Examples:
96
108
  }
97
109
  }
98
110
  }
99
- await writeHeadlessResult(runOptions.format, result, sessionId);
111
+ await writeHeadlessResult(format, result, sessionId, errorCode);
100
112
  safeExit('run', exitCode, exitReason);
101
113
  }));
102
114
  }
@@ -0,0 +1,11 @@
1
+ import type { Step } from '@dexto/tui/tool-step';
2
+ export declare function stepLogEnabled(): boolean;
3
+ /** A line that isn't a tool call: start, done, an error. */
4
+ export declare function logLine(word: string, text: string, { error, at }: {
5
+ error: boolean;
6
+ at?: Date;
7
+ }): string;
8
+ export declare function startLine(model: string, chatId: string, at?: Date): string;
9
+ /** One finished tool call as one line: verb, target, detail, time, state. */
10
+ export declare function stepLine(step: Step, at?: Date): string;
11
+ //# sourceMappingURL=step-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-log.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/step-log.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAMjD,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAMD,4DAA4D;AAC5D,wBAAgB,OAAO,CACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,KAAK,EAAE,EAAe,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,EAAE,CAAC,EAAE,IAAI,CAAA;CAAE,GAC1D,MAAM,CAGR;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,GAAE,IAAiB,GAAG,MAAM,CAEtF;AASD,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAE,IAAiB,GAAG,MAAM,CAWlE"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The Signal log `dexto run` writes to stderr at a terminal: one time-stamped line per step, in
3
+ * the same words as the TUI's step rows. On until the Signal look ships only with
4
+ * DEXTO_PALETTE=signal; the bracketed tags stay the default until then.
5
+ */
6
+ import { chalkStderr as chalk } from 'chalk';
7
+ const VERB_CELLS = 7;
8
+ const TARGET_CELLS = 30;
9
+ const DETAIL_CELLS = 16;
10
+ export function stepLogEnabled() {
11
+ return process.env.DEXTO_PALETTE === 'signal';
12
+ }
13
+ function clock(at) {
14
+ return chalk.dim(at.toLocaleTimeString('en-GB', { hour12: false }));
15
+ }
16
+ /** A line that isn't a tool call: start, done, an error. */
17
+ export function logLine(word, text, { error, at = new Date() }) {
18
+ const label = word.padEnd(VERB_CELLS);
19
+ return `${clock(at)} ${error ? chalk.red(label) : chalk.bold(label)} ${text}`;
20
+ }
21
+ export function startLine(model, chatId, at = new Date()) {
22
+ return logLine('start', `${model} · local · chat ${chatId}`, { error: false, at });
23
+ }
24
+ const STATE_WORD = {
25
+ ok: 'ok',
26
+ fail: 'fail',
27
+ deny: 'denied',
28
+ stop: 'stopped',
29
+ };
30
+ /** One finished tool call as one line: verb, target, detail, time, state. */
31
+ export function stepLine(step, at = new Date()) {
32
+ const failed = step.state === 'fail';
33
+ const word = STATE_WORD[step.state] ?? step.state;
34
+ return [
35
+ `${clock(at)} `,
36
+ chalk.bold(step.verb.toLowerCase().padEnd(VERB_CELLS)),
37
+ step.target.padEnd(TARGET_CELLS),
38
+ (step.detail ?? '').padEnd(DETAIL_CELLS),
39
+ (step.time ?? '').padStart(5),
40
+ ` ${failed ? chalk.red(word) : chalk.dim(word)}`,
41
+ ].join(' ');
42
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,EACnC,OAAO,EACP,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CA4EtC"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,EACnC,OAAO,EACP,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CA2GtC"}