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,223 @@
1
+ // Synthetic Claude Code and Codex transcripts the import tests share.
2
+ import path from 'node:path';
3
+ export const jsonl = (lines) => lines.map((line) => JSON.stringify(line)).join('\n');
4
+ /** A synthetic Claude Code session, shaped as the Agent SDK's messages. */
5
+ export function claudeSession(sessionId) {
6
+ const base = {
7
+ cwd: '/work/api',
8
+ gitBranch: 'main',
9
+ isSidechain: false,
10
+ sessionId,
11
+ version: '2.1.0',
12
+ };
13
+ return jsonl([
14
+ { leafUuid: 'a3', summary: 'Fix the flaky login test', type: 'summary' },
15
+ {
16
+ ...base,
17
+ isMeta: true,
18
+ message: { content: 'Caveat: local commands below.', role: 'user' },
19
+ timestamp: '2026-10-01T10:00:00.000Z',
20
+ type: 'user',
21
+ uuid: 'm0',
22
+ },
23
+ {
24
+ ...base,
25
+ message: { content: '<command-name>/clear</command-name>', role: 'user' },
26
+ timestamp: '2026-10-01T10:00:01.000Z',
27
+ type: 'user',
28
+ uuid: 'm1',
29
+ },
30
+ {
31
+ ...base,
32
+ message: { content: 'Why does login.test.ts fail?', role: 'user' },
33
+ timestamp: '2026-10-01T10:00:02.000Z',
34
+ type: 'user',
35
+ uuid: 'u1',
36
+ },
37
+ {
38
+ ...base,
39
+ message: {
40
+ content: [
41
+ { thinking: 'Let me look.', type: 'thinking' },
42
+ { text: 'Let me run it.', type: 'text' },
43
+ ],
44
+ id: 'msg_1',
45
+ role: 'assistant',
46
+ },
47
+ timestamp: '2026-10-01T10:00:03.000Z',
48
+ type: 'assistant',
49
+ uuid: 'a1',
50
+ },
51
+ {
52
+ ...base,
53
+ message: {
54
+ content: [
55
+ {
56
+ id: 'toolu_1',
57
+ input: { command: 'pnpm test login' },
58
+ name: 'Bash',
59
+ type: 'tool_use',
60
+ },
61
+ ],
62
+ id: 'msg_1',
63
+ role: 'assistant',
64
+ },
65
+ timestamp: '2026-10-01T10:00:04.000Z',
66
+ type: 'assistant',
67
+ uuid: 'a2',
68
+ },
69
+ {
70
+ ...base,
71
+ message: {
72
+ content: [
73
+ {
74
+ content: 'FAIL login.test.ts\nOPENAI_API_KEY=sk-abcdefghijklmnopqrstuvwx',
75
+ tool_use_id: 'toolu_1',
76
+ type: 'tool_result',
77
+ },
78
+ ],
79
+ role: 'user',
80
+ },
81
+ timestamp: '2026-10-01T10:00:05.000Z',
82
+ type: 'user',
83
+ uuid: 'r1',
84
+ },
85
+ {
86
+ ...base,
87
+ isSidechain: true,
88
+ message: { content: [{ text: 'Subagent noise', type: 'text' }], role: 'assistant' },
89
+ timestamp: '2026-10-01T10:00:06.000Z',
90
+ type: 'assistant',
91
+ uuid: 's1',
92
+ },
93
+ {
94
+ ...base,
95
+ message: {
96
+ content: [{ text: 'The test races the clock.', type: 'text' }],
97
+ id: 'msg_2',
98
+ role: 'assistant',
99
+ },
100
+ timestamp: '2026-10-01T10:00:07.000Z',
101
+ type: 'assistant',
102
+ uuid: 'a3',
103
+ },
104
+ { snapshot: {}, type: 'file-history-snapshot' },
105
+ 'not json',
106
+ ]);
107
+ }
108
+ /** A synthetic Codex rollout, shaped as `RolloutItemWire` lines. */
109
+ export function codexRollout(id) {
110
+ return jsonl([
111
+ {
112
+ payload: {
113
+ cli_version: '0.50.0',
114
+ cwd: '/work/web',
115
+ git: { branch: 'feature/x', commit_hash: 'abc' },
116
+ id,
117
+ originator: 'codex_cli_rs',
118
+ timestamp: '2026-10-02T09:00:00.000Z',
119
+ },
120
+ timestamp: '2026-10-02T09:00:00.000Z',
121
+ type: 'session_meta',
122
+ },
123
+ {
124
+ payload: {
125
+ content: [{ text: 'You are Codex.', type: 'input_text' }],
126
+ role: 'developer',
127
+ type: 'message',
128
+ },
129
+ timestamp: '2026-10-02T09:00:00.100Z',
130
+ type: 'response_item',
131
+ },
132
+ {
133
+ payload: {
134
+ content: [
135
+ {
136
+ text: '<environment_context>\n <cwd>/work/web</cwd>\n</environment_context>',
137
+ type: 'input_text',
138
+ },
139
+ ],
140
+ role: 'user',
141
+ type: 'message',
142
+ },
143
+ timestamp: '2026-10-02T09:00:00.200Z',
144
+ type: 'response_item',
145
+ },
146
+ {
147
+ payload: {
148
+ content: [{ text: 'List the routes.', type: 'input_text' }],
149
+ role: 'user',
150
+ type: 'message',
151
+ },
152
+ timestamp: '2026-10-02T09:00:01.000Z',
153
+ type: 'response_item',
154
+ },
155
+ {
156
+ payload: { content: null, encrypted_content: 'x', summary: [], type: 'reasoning' },
157
+ timestamp: '2026-10-02T09:00:02.000Z',
158
+ type: 'response_item',
159
+ },
160
+ {
161
+ payload: {
162
+ arguments: '{"command":["rg","route"]}',
163
+ call_id: 'call_1',
164
+ name: 'shell',
165
+ type: 'function_call',
166
+ },
167
+ timestamp: '2026-10-02T09:00:03.000Z',
168
+ type: 'response_item',
169
+ },
170
+ {
171
+ payload: { call_id: 'call_1', output: 'src/routes.ts', type: 'function_call_output' },
172
+ timestamp: '2026-10-02T09:00:04.000Z',
173
+ type: 'response_item',
174
+ },
175
+ {
176
+ payload: {
177
+ call_id: 'call_2',
178
+ input: '*** Begin Patch',
179
+ name: 'apply_patch',
180
+ type: 'custom_tool_call',
181
+ },
182
+ timestamp: '2026-10-02T09:00:05.000Z',
183
+ type: 'response_item',
184
+ },
185
+ {
186
+ payload: {
187
+ call_id: 'call_2',
188
+ output: [{ text: 'Done.', type: 'input_text' }],
189
+ type: 'custom_tool_call_output',
190
+ },
191
+ timestamp: '2026-10-02T09:00:06.000Z',
192
+ type: 'response_item',
193
+ },
194
+ {
195
+ payload: {
196
+ content: [{ text: 'One route: /health.', type: 'output_text' }],
197
+ role: 'assistant',
198
+ type: 'message',
199
+ },
200
+ timestamp: '2026-10-02T09:00:07.000Z',
201
+ type: 'response_item',
202
+ },
203
+ {
204
+ payload: { message: 'ignored', type: 'agent_message' },
205
+ timestamp: '2026-10-02T09:00:08.000Z',
206
+ type: 'event_msg',
207
+ },
208
+ ]);
209
+ }
210
+ /** A Codex `state_5.sqlite` with the `threads` columns an import reads, holding these rows. */
211
+ export async function writeCodexState(home, threads) {
212
+ const { default: Database } = await import('better-sqlite3');
213
+ const db = new Database(path.join(home, 'state_5.sqlite'));
214
+ try {
215
+ db.exec('CREATE TABLE threads (id TEXT PRIMARY KEY, rollout_path TEXT, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, cwd TEXT NOT NULL, title TEXT NOT NULL, archived INTEGER NOT NULL DEFAULT 0, name TEXT)');
216
+ const insert = db.prepare('INSERT INTO threads (id, rollout_path, created_at, updated_at, cwd, title, archived, name) VALUES (?, ?, 0, ?, ?, ?, ?, ?)');
217
+ for (const thread of threads)
218
+ insert.run(thread.id, thread.rolloutPath, Math.floor(new Date(thread.updatedAt).getTime() / 1_000), thread.cwd, thread.title, thread.archived === true ? 1 : 0, thread.name ?? null);
219
+ }
220
+ finally {
221
+ db.close();
222
+ }
223
+ }
@@ -0,0 +1,75 @@
1
+ export type LocalChatSource = 'claude-code' | 'codex';
2
+ export declare const LOCAL_CHAT_SOURCES: readonly LocalChatSource[];
3
+ export interface LocalChatMessage {
4
+ readonly createdAt: string;
5
+ readonly role: 'assistant' | 'user';
6
+ readonly text: string;
7
+ }
8
+ /** A pull request the session opened or worked on, as Claude Code's `pr-link` lines record it. */
9
+ export interface LocalPullRequest {
10
+ readonly number: number;
11
+ /** `owner/name` on GitHub. */
12
+ readonly repository: string;
13
+ readonly url: string;
14
+ }
15
+ /** The git repository a session ran in. */
16
+ export interface LocalRepository {
17
+ /**
18
+ * The main checkout's folder, so a worktree's sessions name the repository it belongs to; null
19
+ * when the folder the session ran in is no longer on this machine.
20
+ */
21
+ readonly root: string | null;
22
+ /** The `origin` remote, without any credentials in it, or null when there is none. */
23
+ readonly remoteUrl: string | null;
24
+ }
25
+ export interface LocalChat {
26
+ /** Where the session started. */
27
+ readonly cwd: string | null;
28
+ readonly gitBranch: string | null;
29
+ readonly id: string;
30
+ readonly messages: readonly LocalChatMessage[];
31
+ /** The transcript file it was read from. */
32
+ readonly path: string;
33
+ readonly pullRequests: readonly LocalPullRequest[];
34
+ /** The repository `cwd` is in, or null when it is in none or nothing about it is known. */
35
+ readonly repository: LocalRepository | null;
36
+ readonly source: LocalChatSource;
37
+ readonly startedAt: string;
38
+ readonly title: string;
39
+ readonly updatedAt: string;
40
+ }
41
+ /** What a parser reads from the transcript alone; the finder adds the repository from disk. */
42
+ export type ParsedChat = Omit<LocalChat, 'repository'> & {
43
+ /** The `origin` the source recorded when the session ran, if it records one. */
44
+ readonly recordedRemoteUrl: string | null;
45
+ };
46
+ /**
47
+ * Collects turns as a chat shows them: each person's message, then one assistant message holding
48
+ * everything the agent said and ran until the next one.
49
+ */
50
+ export declare function createTurns(): {
51
+ assistant(text: string, createdAt: string): void;
52
+ /** The turns, and when the last thing in them happened. */
53
+ done(): Turns;
54
+ user(text: string, createdAt: string): void;
55
+ };
56
+ interface Turns {
57
+ readonly lastAt: string | null;
58
+ readonly messages: readonly LocalChatMessage[];
59
+ }
60
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
61
+ export declare function stringField(value: Record<string, unknown>, key: string): string | null;
62
+ /** Each line that is a JSON object; a torn or foreign line is left out. */
63
+ export declare function jsonLines(text: string): Record<string, unknown>[];
64
+ export declare function validTime(value: string | null): string | null;
65
+ /**
66
+ * The chat, titled by what the source named it or else by the person's first line; null when
67
+ * there is nothing the person said.
68
+ */
69
+ export declare function finishChat(fields: Omit<ParsedChat, 'messages' | 'startedAt' | 'title' | 'updatedAt'> & {
70
+ readonly title: string | null;
71
+ }, { lastAt, messages }: Turns): ParsedChat | null;
72
+ export declare function toolCallText(name: string, input: unknown): string;
73
+ export declare function toolResultText(output: string): string;
74
+ export {};
75
+ //# sourceMappingURL=transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../src/cli/import/transcript.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,123 @@
1
+ // What a local Claude Code or Codex session reads into, and the helpers both parsers share.
2
+ import { redactSecrets, truncate } from './redaction.js';
3
+ export const LOCAL_CHAT_SOURCES = ['claude-code', 'codex'];
4
+ /**
5
+ * Collects turns as a chat shows them: each person's message, then one assistant message holding
6
+ * everything the agent said and ran until the next one.
7
+ */
8
+ export function createTurns() {
9
+ const messages = [];
10
+ let assistant = null;
11
+ let lastAt = null;
12
+ const flush = () => {
13
+ if (assistant !== null && assistant.parts.length > 0)
14
+ messages.push({
15
+ createdAt: assistant.createdAt,
16
+ role: 'assistant',
17
+ text: assistant.parts.join('\n\n'),
18
+ });
19
+ assistant = null;
20
+ };
21
+ return {
22
+ assistant(text, createdAt) {
23
+ if (text.trim() === '')
24
+ return;
25
+ assistant ??= { createdAt, parts: [] };
26
+ assistant.parts.push(text.trim());
27
+ lastAt = createdAt;
28
+ },
29
+ /** The turns, and when the last thing in them happened. */
30
+ done() {
31
+ flush();
32
+ return { lastAt, messages };
33
+ },
34
+ user(text, createdAt) {
35
+ if (text.trim() === '')
36
+ return;
37
+ flush();
38
+ messages.push({ createdAt, role: 'user', text: text.trim() });
39
+ lastAt = createdAt;
40
+ },
41
+ };
42
+ }
43
+ export function isRecord(value) {
44
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
45
+ }
46
+ export function stringField(value, key) {
47
+ const field = value[key];
48
+ return typeof field === 'string' && field.trim() !== '' ? field : null;
49
+ }
50
+ /** Each line that is a JSON object; a torn or foreign line is left out. */
51
+ export function jsonLines(text) {
52
+ return text.split('\n').flatMap((line) => {
53
+ if (line.trim() === '')
54
+ return [];
55
+ try {
56
+ const value = JSON.parse(line);
57
+ return isRecord(value) ? [value] : [];
58
+ }
59
+ catch {
60
+ return [];
61
+ }
62
+ });
63
+ }
64
+ export function validTime(value) {
65
+ if (value === null)
66
+ return null;
67
+ const time = new Date(value);
68
+ return Number.isNaN(time.getTime()) ? null : time.toISOString();
69
+ }
70
+ function firstLine(text) {
71
+ const line = text.split('\n').find((each) => each.trim() !== '') ?? '';
72
+ return truncate(redactSecrets(line.trim()).text, 80);
73
+ }
74
+ /**
75
+ * The chat, titled by what the source named it or else by the person's first line; null when
76
+ * there is nothing the person said.
77
+ */
78
+ export function finishChat(fields, { lastAt, messages }) {
79
+ const first = messages[0];
80
+ const firstUser = messages.find((message) => message.role === 'user');
81
+ if (first === undefined || lastAt === null || firstUser === undefined)
82
+ return null;
83
+ return {
84
+ ...fields,
85
+ messages,
86
+ startedAt: first.createdAt,
87
+ title: truncate(redactSecrets(fields.title?.trim() ?? firstLine(firstUser.text)).text, 200),
88
+ updatedAt: lastAt,
89
+ };
90
+ }
91
+ // ---------------------------------------------------------------------------------------------
92
+ // Tool history as text
93
+ // ---------------------------------------------------------------------------------------------
94
+ /** How much of one tool call's input or result an imported chat keeps. */
95
+ const MAX_TOOL_CHARS = 4_000;
96
+ /** Text in a fence no backtick run inside it can close. */
97
+ function fenced(text) {
98
+ const longest = Math.max(2, ...[...text.matchAll(/`+/gu)].map((run) => run[0].length));
99
+ const fence = '`'.repeat(longest + 1);
100
+ return `${fence}\n${text}\n${fence}`;
101
+ }
102
+ /** Redacted whole, then cut: a cut can leave a secret no pattern still matches. */
103
+ function toolBody(text) {
104
+ return fenced(truncate(redactSecrets(text).text, MAX_TOOL_CHARS));
105
+ }
106
+ /** A JSON string pretty-printed, or as it is when it isn't JSON. */
107
+ function prettyJson(text) {
108
+ try {
109
+ return JSON.stringify(JSON.parse(text), null, 2);
110
+ }
111
+ catch {
112
+ return text;
113
+ }
114
+ }
115
+ export function toolCallText(name, input) {
116
+ const body = typeof input === 'string'
117
+ ? prettyJson(redactSecrets(input).text)
118
+ : JSON.stringify(input ?? null, (_key, value) => typeof value === 'string' ? redactSecrets(value).text : value, 2);
119
+ return `**Tool call: ${name}**\n${toolBody(body)}`;
120
+ }
121
+ export function toolResultText(output) {
122
+ return `**Tool result**\n${toolBody(output)}`;
123
+ }
@@ -0,0 +1,18 @@
1
+ interface InteractionContext {
2
+ readonly invocation: readonly string[];
3
+ readonly runtime: {
4
+ readonly prompt: ((question: string, options: {
5
+ secret: boolean;
6
+ }) => Promise<string>) | null;
7
+ };
8
+ }
9
+ /** Asks yes or no at a terminal; without one, only an explicit flag agrees. */
10
+ export declare function confirm(context: InteractionContext, question: string): Promise<boolean>;
11
+ /** Goes ahead with explicit consent or an interactive confirmation. */
12
+ export declare function requireConsent(context: InteractionContext, yes: boolean, what: string): Promise<void>;
13
+ export declare function requireInteractive(interactive: boolean, flag: string): void;
14
+ /** The invocation with extra arguments, quoted for a shell. */
15
+ export declare function rerunWith(context: Pick<InteractionContext, 'invocation'>, ...extra: string[]): string;
16
+ export declare function shellWord(word: string): string;
17
+ export {};
18
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../src/cli/interaction.ts"],"names":[],"mappings":"AACA,UAAU,kBAAkB;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE;QACd,QAAQ,CAAC,MAAM,EACT,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;YAAE,MAAM,EAAE,OAAO,CAAA;SAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GACrE,IAAI,CAAC;KACd,CAAC;CACL;AAED,+EAA+E;AAC/E,wBAAsB,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAI7F;AAED,uEAAuE;AACvE,wBAAsB,cAAc,CAChC,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO3E;AAED,+DAA+D;AAC/D,wBAAgB,SAAS,CACrB,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,EAC/C,GAAG,KAAK,EAAE,MAAM,EAAE,GACnB,MAAM,CAER;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
@@ -0,0 +1,30 @@
1
+ import { CommandFailure } from './failure.js';
2
+ /** Asks yes or no at a terminal; without one, only an explicit flag agrees. */
3
+ export async function confirm(context, question) {
4
+ if (context.runtime.prompt === null)
5
+ return false;
6
+ const answer = await context.runtime.prompt(`${question} [y/N] `, { secret: false });
7
+ return /^y(es)?$/iu.test(answer.trim());
8
+ }
9
+ /** Goes ahead with explicit consent or an interactive confirmation. */
10
+ export async function requireConsent(context, yes, what) {
11
+ if (yes)
12
+ return;
13
+ if (context.runtime.prompt !== null) {
14
+ if (await confirm(context, `${what} Go ahead?`))
15
+ return;
16
+ throw new CommandFailure('needs_confirmation', 'Not done.', null);
17
+ }
18
+ throw new CommandFailure('needs_confirmation', `${what} Run it again with --yes once your person has agreed.`, rerunWith(context, '--yes'));
19
+ }
20
+ export function requireInteractive(interactive, flag) {
21
+ if (!interactive)
22
+ throw new CommandFailure('invalid_input', `Pass ${flag} when running non-interactively.`, null);
23
+ }
24
+ /** The invocation with extra arguments, quoted for a shell. */
25
+ export function rerunWith(context, ...extra) {
26
+ return ['dexto', ...context.invocation, ...extra].map(shellWord).join(' ');
27
+ }
28
+ export function shellWord(word) {
29
+ return /^[\w@%+=:,./-]+$/u.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
30
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli/modes/cli.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAuBpD,wBAAsB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2QxE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli/modes/cli.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAuBpD,wBAAsB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA+SxE"}
@@ -133,7 +133,7 @@ export async function runCliMode(context) {
133
133
  const existing = await agent.getSession(opts.resume);
134
134
  if (!existing) {
135
135
  console.error(`❌ Session '${opts.resume}' not found`);
136
- console.error('💡 Use `dexto session list` to see available sessions');
136
+ console.error('💡 Use `dexto chat list` to see available sessions');
137
137
  safeExit('main', 1, 'resume-failed');
138
138
  }
139
139
  cliSessionId = opts.resume;
@@ -166,12 +166,14 @@ export async function runCliMode(context) {
166
166
  console.info = noOp;
167
167
  let inkError = undefined;
168
168
  try {
169
- const [{ startInkCliRefactored, setTuiRuntimeServices }, { registerGracefulShutdown }, { applyLayeredEnvironmentLoading }, { getProviderDisplayName, isValidApiKeyFormat, getProviderInstructions }, { performDeviceCodeLogin, persistDeviceApiKeyLoginResult, ensureDextoApiKeyForAuthToken, loadAuth, storeAuth, removeAuth, removeDextoApiKeyFromEnv, buildDextoBillingUrl, openDextoBillingPage, }, { isUsingDextoCredits }, { canUseDextoProvider }, { capture },] = await Promise.all([
169
+ const [{ startInkCliRefactored, setTuiRuntimeServices }, { registerGracefulShutdown }, { applyLayeredEnvironmentLoading }, { getProviderDisplayName, isValidApiKeyFormat, getProviderInstructions }, { buildDextoBillingUrl, openDextoBillingPage }, { describeSignIn, login, logout }, { nodeSignInContext }, { isUsingDextoCredits }, { canUseDextoProvider }, { capture },] = await Promise.all([
170
170
  import('@dexto/tui'),
171
171
  import('../../utils/graceful-shutdown.js'),
172
172
  import('../../utils/env.js'),
173
173
  import('../utils/provider-setup.js'),
174
174
  import('../auth/index.js'),
175
+ import('../commands/auth/sign-in-commands.js'),
176
+ import('../commands/auth/sign-in-context.js'),
175
177
  import('../../config/effective-llm.js'),
176
178
  import('../utils/dexto-setup.js'),
177
179
  import('../../analytics/index.js'),
@@ -185,17 +187,48 @@ export async function runCliMode(context) {
185
187
  getProviderDisplayName,
186
188
  isValidApiKeyFormat,
187
189
  getProviderInstructions,
188
- performDeviceCodeLogin,
189
- persistDeviceApiKeyLoginResult,
190
- ensureDextoApiKeyForAuthToken,
191
- loadAuth,
192
- storeAuth,
193
- removeAuth,
194
- removeDextoApiKeyFromEnv,
190
+ currentSignIn: async () => describeSignIn(await nodeSignInContext({
191
+ result: () => undefined,
192
+ confirm: async () => false,
193
+ note: () => undefined,
194
+ signal: new AbortController().signal,
195
+ })),
196
+ signIn: async ({ signal, onNote }) => {
197
+ const printed = [];
198
+ await login(await nodeSignInContext({
199
+ result: (_value, text) => printed.push(text),
200
+ confirm: async () => false,
201
+ note: onNote,
202
+ signal,
203
+ }), {
204
+ profile: null,
205
+ org: null,
206
+ device: false,
207
+ browser: true,
208
+ scopes: [],
209
+ apiKey: null,
210
+ });
211
+ return printed.join('\n');
212
+ },
213
+ signOut: async () => {
214
+ const said = [];
215
+ await logout(await nodeSignInContext({
216
+ result: (_value, text) => said.push(text),
217
+ confirm: async () => false,
218
+ note: (text) => said.push(text),
219
+ signal: new AbortController().signal,
220
+ }), { profile: null });
221
+ return said.join('\n');
222
+ },
195
223
  isUsingDextoCredits,
196
224
  canUseDextoProvider,
197
225
  buildDextoBillingUrl,
198
226
  openDextoBillingPage,
227
+ dextoCreditBalance: async () => {
228
+ const { dextoGateway } = await import('@dexto/agent-management');
229
+ const summary = await dextoGateway.dextoBillingSummary(dextoGateway.defaultDextoGatewayOptions());
230
+ return summary?.balanceUsd ?? null;
231
+ },
199
232
  });
200
233
  await startInkCliRefactored(agent, cliSessionId, {
201
234
  updateInfo: cliUpdateInfo ?? undefined,
@@ -19,15 +19,15 @@ export async function runServerMode(context) {
19
19
  })();
20
20
  const apiPort = getPort(process.env.PORT, defaultPort, 'PORT');
21
21
  const apiUrl = process.env.DEXTO_URL ?? `http://localhost:${apiPort}`;
22
- console.log('🌐 Starting server (REST APIs + SSE)...');
22
+ console.error('🌐 Starting server (REST APIs + SSE)...');
23
23
  await startHonoApiServer(agent, apiPort, agentCard, derivedAgentId, resolvedPath, workspaceRoot);
24
- console.log(`✅ Server running at ${apiUrl}`);
25
- console.log('Available endpoints:');
26
- console.log(' POST /api/message - Send async message');
27
- console.log(' POST /api/message-sync - Send sync message');
28
- console.log(' POST /api/reset - Reset conversation');
29
- console.log(' GET /api/mcp/servers - List MCP servers');
30
- console.log(' SSE support available for real-time events');
24
+ console.error(`✅ Server running at ${apiUrl}`);
25
+ console.error('Available endpoints:');
26
+ console.error(' POST /api/message - Send async message');
27
+ console.error(' POST /api/message-sync - Send sync message');
28
+ console.error(' POST /api/reset - Reset conversation');
29
+ console.error(' GET /api/mcp/servers - List MCP servers');
30
+ console.error(' SSE support available for real-time events');
31
31
  const serverUpdateInfo = await getVersionCheckResult();
32
32
  if (serverUpdateInfo) {
33
33
  const { displayUpdateNotification } = await import('../utils/version-check.js');
@@ -31,7 +31,7 @@ export async function runWebMode(context) {
31
31
  }
32
32
  const webUIConfig = webRoot ? { analytics: await getWebUIAnalyticsConfig() } : undefined;
33
33
  await startHonoApiServer(agent, port, agent.config.agentCard || {}, derivedAgentId, resolvedPath, workspaceRoot, webRoot, webUIConfig);
34
- console.log(chalk.green(`✅ Server running at ${serverUrl}`));
34
+ console.error(chalk.green(`✅ Server running at ${serverUrl}`));
35
35
  const webUpdateInfo = await getVersionCheckResult();
36
36
  if (webUpdateInfo) {
37
37
  const { displayUpdateNotification } = await import('../utils/version-check.js');
@@ -41,10 +41,10 @@ export async function runWebMode(context) {
41
41
  try {
42
42
  const { default: open } = await import('open');
43
43
  await open(serverUrl, { wait: false });
44
- console.log(chalk.green(`🌐 Opened WebUI in browser: ${serverUrl}`));
44
+ console.error(chalk.green(`🌐 Opened WebUI in browser: ${serverUrl}`));
45
45
  }
46
46
  catch (_error) {
47
- console.log(chalk.yellow(`💡 WebUI is available at: ${serverUrl}`));
47
+ console.error(chalk.yellow(`💡 WebUI is available at: ${serverUrl}`));
48
48
  }
49
49
  }
50
50
  }
@@ -0,0 +1,9 @@
1
+ export declare function jsonResult(value: unknown): string;
2
+ export declare function jsonError(error: {
3
+ code: string;
4
+ message: string;
5
+ fix?: string;
6
+ api_code?: string;
7
+ details?: unknown;
8
+ }): string;
9
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,MAAM,CAET"}
@@ -0,0 +1,6 @@
1
+ export function jsonResult(value) {
2
+ return `${JSON.stringify(value, null, 2)}\n`;
3
+ }
4
+ export function jsonError(error) {
5
+ return jsonResult({ error });
6
+ }
@@ -42,7 +42,7 @@ export interface DextoAuthCheckResult {
42
42
  * const result = await checkDextoAuthState(true, 'coding-agent');
43
43
  * if (!result.shouldContinue) {
44
44
  * if (result.action === 'login') {
45
- * await handleLoginCommand();
45
+ * await signInForDextoModels();
46
46
  * } else if (result.action === 'setup') {
47
47
  * await handleSetupCommand();
48
48
  * }
@@ -1 +1 @@
1
- {"version":3,"file":"dexto-auth-check.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/dexto-auth-check.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,MAAM,WAAW,oBAAoB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,mBAAmB,CACrC,WAAW,GAAE,OAAc,EAC3B,OAAO,GAAE,MAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAoE/B"}
1
+ {"version":3,"file":"dexto-auth-check.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/dexto-auth-check.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,MAAM,WAAW,oBAAoB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,mBAAmB,CACrC,WAAW,GAAE,OAAc,EAC3B,OAAO,GAAE,MAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAmE/B"}