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.
- package/dist/agents/coding-agent/coding-agent.yml +0 -2
- package/dist/cli/agent-audit.d.ts +12 -0
- package/dist/cli/agent-audit.d.ts.map +1 -0
- package/dist/cli/agent-audit.js +52 -0
- package/dist/cli/auth/billing.d.ts +0 -6
- package/dist/cli/auth/billing.d.ts.map +1 -1
- package/dist/cli/auth/billing.js +0 -23
- package/dist/cli/auth/constants.d.ts +3 -31
- package/dist/cli/auth/constants.d.ts.map +1 -1
- package/dist/cli/auth/constants.js +9 -33
- package/dist/cli/auth/index.d.ts +2 -9
- package/dist/cli/auth/index.d.ts.map +1 -1
- package/dist/cli/auth/index.js +2 -7
- package/dist/cli/auth/sign-in-runtime.d.ts +12 -0
- package/dist/cli/auth/sign-in-runtime.d.ts.map +1 -0
- package/dist/cli/auth/sign-in-runtime.js +59 -0
- package/dist/cli/cloud/app-scopes.d.ts +4 -0
- package/dist/cli/cloud/app-scopes.d.ts.map +1 -0
- package/dist/cli/cloud/app-scopes.js +19 -0
- package/dist/cli/cloud/command.d.ts +107 -0
- package/dist/cli/cloud/command.d.ts.map +1 -0
- package/dist/cli/cloud/command.js +154 -0
- package/dist/cli/cloud/commands/account.d.ts +11 -0
- package/dist/cli/cloud/commands/account.d.ts.map +1 -0
- package/dist/cli/cloud/commands/account.js +129 -0
- package/dist/cli/cloud/commands/agents.d.ts +3 -0
- package/dist/cli/cloud/commands/agents.d.ts.map +1 -0
- package/dist/cli/cloud/commands/agents.js +526 -0
- package/dist/cli/cloud/commands/api.d.ts +3 -0
- package/dist/cli/cloud/commands/api.d.ts.map +1 -0
- package/dist/cli/cloud/commands/api.js +26 -0
- package/dist/cli/cloud/commands/app-files.d.ts +29 -0
- package/dist/cli/cloud/commands/app-files.d.ts.map +1 -0
- package/dist/cli/cloud/commands/app-files.js +72 -0
- package/dist/cli/cloud/commands/artifacts.d.ts +3 -0
- package/dist/cli/cloud/commands/artifacts.d.ts.map +1 -0
- package/dist/cli/cloud/commands/artifacts.js +267 -0
- package/dist/cli/cloud/commands/automations.d.ts +3 -0
- package/dist/cli/cloud/commands/automations.d.ts.map +1 -0
- package/dist/cli/cloud/commands/automations.js +233 -0
- package/dist/cli/cloud/commands/chats.d.ts +3 -0
- package/dist/cli/cloud/commands/chats.d.ts.map +1 -0
- package/dist/cli/cloud/commands/chats.js +204 -0
- package/dist/cli/cloud/commands/data-deletions.d.ts +3 -0
- package/dist/cli/cloud/commands/data-deletions.d.ts.map +1 -0
- package/dist/cli/cloud/commands/data-deletions.js +55 -0
- package/dist/cli/cloud/commands/deploys.d.ts +10 -0
- package/dist/cli/cloud/commands/deploys.d.ts.map +1 -0
- package/dist/cli/cloud/commands/deploys.js +225 -0
- package/dist/cli/cloud/commands/drive.d.ts +12 -0
- package/dist/cli/cloud/commands/drive.d.ts.map +1 -0
- package/dist/cli/cloud/commands/drive.js +321 -0
- package/dist/cli/cloud/commands/files.d.ts +24 -0
- package/dist/cli/cloud/commands/files.d.ts.map +1 -0
- package/dist/cli/cloud/commands/files.js +284 -0
- package/dist/cli/cloud/commands/find.d.ts +3 -0
- package/dist/cli/cloud/commands/find.d.ts.map +1 -0
- package/dist/cli/cloud/commands/find.js +63 -0
- package/dist/cli/cloud/commands/models.d.ts +3 -0
- package/dist/cli/cloud/commands/models.d.ts.map +1 -0
- package/dist/cli/cloud/commands/models.js +250 -0
- package/dist/cli/cloud/commands/profile.d.ts +3 -0
- package/dist/cli/cloud/commands/profile.d.ts.map +1 -0
- package/dist/cli/cloud/commands/profile.js +120 -0
- package/dist/cli/cloud/commands/projects.d.ts +5 -0
- package/dist/cli/cloud/commands/projects.d.ts.map +1 -0
- package/dist/cli/cloud/commands/projects.js +66 -0
- package/dist/cli/cloud/commands/publish.d.ts +3 -0
- package/dist/cli/cloud/commands/publish.d.ts.map +1 -0
- package/dist/cli/cloud/commands/publish.js +139 -0
- package/dist/cli/cloud/commands/sandboxes.d.ts +3 -0
- package/dist/cli/cloud/commands/sandboxes.d.ts.map +1 -0
- package/dist/cli/cloud/commands/sandboxes.js +266 -0
- package/dist/cli/cloud/commands/secrets.d.ts +3 -0
- package/dist/cli/cloud/commands/secrets.d.ts.map +1 -0
- package/dist/cli/cloud/commands/secrets.js +111 -0
- package/dist/cli/cloud/commands/skills.d.ts +3 -0
- package/dist/cli/cloud/commands/skills.d.ts.map +1 -0
- package/dist/cli/cloud/commands/skills.js +203 -0
- package/dist/cli/cloud/commands/traces.d.ts +3 -0
- package/dist/cli/cloud/commands/traces.d.ts.map +1 -0
- package/dist/cli/cloud/commands/traces.js +142 -0
- package/dist/cli/cloud/commands/web.d.ts +3 -0
- package/dist/cli/cloud/commands/web.d.ts.map +1 -0
- package/dist/cli/cloud/commands/web.js +53 -0
- package/dist/cli/cloud/commands/workspace-apps.d.ts +58 -0
- package/dist/cli/cloud/commands/workspace-apps.d.ts.map +1 -0
- package/dist/cli/cloud/commands/workspace-apps.js +657 -0
- package/dist/cli/cloud/commands/workspace.d.ts +36 -0
- package/dist/cli/cloud/commands/workspace.d.ts.map +1 -0
- package/dist/cli/cloud/commands/workspace.js +281 -0
- package/dist/cli/cloud/connection.d.ts +33 -0
- package/dist/cli/cloud/connection.d.ts.map +1 -0
- package/dist/cli/cloud/connection.js +38 -0
- package/dist/cli/cloud/events.d.ts +63 -0
- package/dist/cli/cloud/events.d.ts.map +1 -0
- package/dist/cli/cloud/events.js +72 -0
- package/dist/cli/cloud/host.d.ts +9 -0
- package/dist/cli/cloud/host.d.ts.map +1 -0
- package/dist/cli/cloud/host.js +109 -0
- package/dist/cli/cloud/output.d.ts +34 -0
- package/dist/cli/cloud/output.d.ts.map +1 -0
- package/dist/cli/cloud/output.js +77 -0
- package/dist/cli/cloud/run.d.ts +26 -0
- package/dist/cli/cloud/run.d.ts.map +1 -0
- package/dist/cli/cloud/run.js +444 -0
- package/dist/cli/cloud/runtime.d.ts +33 -0
- package/dist/cli/cloud/runtime.d.ts.map +1 -0
- package/dist/cli/cloud/runtime.js +86 -0
- package/dist/cli/cloud/tar.d.ts +9 -0
- package/dist/cli/cloud/tar.d.ts.map +1 -0
- package/dist/cli/cloud/tar.js +69 -0
- package/dist/cli/cloud/transfer.d.ts +13 -0
- package/dist/cli/cloud/transfer.d.ts.map +1 -0
- package/dist/cli/cloud/transfer.js +36 -0
- package/dist/cli/cloud/v1.d.ts +20 -0
- package/dist/cli/cloud/v1.d.ts.map +1 -0
- package/dist/cli/cloud/v1.js +66 -0
- package/dist/cli/cloud/zip.d.ts +8 -0
- package/dist/cli/cloud/zip.d.ts.map +1 -0
- package/dist/cli/cloud/zip.js +66 -0
- package/dist/cli/commands/auth/sign-in-commands.d.ts +62 -0
- package/dist/cli/commands/auth/sign-in-commands.d.ts.map +1 -0
- package/dist/cli/commands/auth/sign-in-commands.js +248 -0
- package/dist/cli/commands/auth/sign-in-context.d.ts +16 -0
- package/dist/cli/commands/auth/sign-in-context.d.ts.map +1 -0
- package/dist/cli/commands/auth/sign-in-context.js +68 -0
- package/dist/cli/commands/cloud/register.d.ts +5 -0
- package/dist/cli/commands/cloud/register.d.ts.map +1 -1
- package/dist/cli/commands/cloud/register.js +44 -24
- package/dist/cli/commands/create-app.js +5 -6
- package/dist/cli/commands/create-image.d.ts.map +1 -1
- package/dist/cli/commands/create-image.js +9 -10
- package/dist/cli/commands/index.d.ts +0 -2
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +0 -2
- package/dist/cli/commands/init.d.ts +0 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +5 -26
- package/dist/cli/commands/run/headless.d.ts.map +1 -1
- package/dist/cli/commands/run/headless.js +57 -2
- package/dist/cli/commands/run/output.d.ts +29 -10
- package/dist/cli/commands/run/output.d.ts.map +1 -1
- package/dist/cli/commands/run/output.js +44 -22
- package/dist/cli/commands/run/register.d.ts.map +1 -1
- package/dist/cli/commands/run/register.js +21 -9
- package/dist/cli/commands/run/step-log.d.ts +11 -0
- package/dist/cli/commands/run/step-log.d.ts.map +1 -0
- package/dist/cli/commands/run/step-log.js +42 -0
- package/dist/cli/commands/session/register.d.ts.map +1 -1
- package/dist/cli/commands/session/register.js +51 -21
- package/dist/cli/commands/session-commands.js +1 -1
- package/dist/cli/commands/setup.js +17 -14
- package/dist/cli/failure.d.ts +29 -0
- package/dist/cli/failure.d.ts.map +1 -0
- package/dist/cli/failure.js +31 -0
- package/dist/cli/help-json.d.ts +22 -0
- package/dist/cli/help-json.d.ts.map +1 -0
- package/dist/cli/help-json.js +20 -0
- package/dist/cli/import/claude-code.d.ts +10 -0
- package/dist/cli/import/claude-code.d.ts.map +1 -0
- package/dist/cli/import/claude-code.js +131 -0
- package/dist/cli/import/codex.d.ts +27 -0
- package/dist/cli/import/codex.d.ts.map +1 -0
- package/dist/cli/import/codex.js +148 -0
- package/dist/cli/import/git.d.ts +19 -0
- package/dist/cli/import/git.d.ts.map +1 -0
- package/dist/cli/import/git.js +95 -0
- package/dist/cli/import/local-chats.d.ts +28 -0
- package/dist/cli/import/local-chats.d.ts.map +1 -0
- package/dist/cli/import/local-chats.js +129 -0
- package/dist/cli/import/redaction.d.ts +37 -0
- package/dist/cli/import/redaction.d.ts.map +1 -0
- package/dist/cli/import/redaction.js +148 -0
- package/dist/cli/import/test-utils.d.ts +16 -0
- package/dist/cli/import/test-utils.d.ts.map +1 -0
- package/dist/cli/import/test-utils.js +223 -0
- package/dist/cli/import/transcript.d.ts +75 -0
- package/dist/cli/import/transcript.d.ts.map +1 -0
- package/dist/cli/import/transcript.js +123 -0
- package/dist/cli/interaction.d.ts +18 -0
- package/dist/cli/interaction.d.ts.map +1 -0
- package/dist/cli/interaction.js +30 -0
- package/dist/cli/modes/cli.d.ts.map +1 -1
- package/dist/cli/modes/cli.js +42 -9
- package/dist/cli/modes/server.js +8 -8
- package/dist/cli/modes/web.js +3 -3
- package/dist/cli/output.d.ts +9 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +6 -0
- package/dist/cli/utils/dexto-auth-check.d.ts +1 -1
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -1
- package/dist/cli/utils/dexto-auth-check.js +4 -5
- package/dist/cli/utils/dexto-setup.d.ts +4 -5
- package/dist/cli/utils/dexto-setup.d.ts.map +1 -1
- package/dist/cli/utils/dexto-setup.js +17 -14
- package/dist/cli/utils/provider-setup.js +1 -1
- package/dist/cli/utils/scaffolding-utils.d.ts +9 -3
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
- package/dist/cli/utils/scaffolding-utils.js +48 -40
- package/dist/cli/utils/version-check.d.ts.map +1 -1
- package/dist/cli/utils/version-check.js +2 -1
- package/dist/index-main.js +44 -65
- package/dist/webui/assets/index-D9xiOs62.js +1649 -0
- package/dist/webui/index.html +1 -1
- package/package.json +15 -14
- package/dist/cli/auth/api-client.d.ts +0 -125
- package/dist/cli/auth/api-client.d.ts.map +0 -1
- package/dist/cli/auth/api-client.js +0 -585
- package/dist/cli/auth/device.d.ts +0 -14
- package/dist/cli/auth/device.d.ts.map +0 -1
- package/dist/cli/auth/device.js +0 -84
- package/dist/cli/auth/dexto-api-key.d.ts +0 -34
- package/dist/cli/auth/dexto-api-key.d.ts.map +0 -1
- package/dist/cli/auth/dexto-api-key.js +0 -160
- package/dist/cli/auth/login-persistence.d.ts +0 -15
- package/dist/cli/auth/login-persistence.d.ts.map +0 -1
- package/dist/cli/auth/login-persistence.js +0 -72
- package/dist/cli/auth/oauth.d.ts +0 -39
- package/dist/cli/auth/oauth.d.ts.map +0 -1
- package/dist/cli/auth/oauth.js +0 -434
- package/dist/cli/auth/service.d.ts +0 -24
- package/dist/cli/auth/service.d.ts.map +0 -1
- package/dist/cli/auth/service.js +0 -161
- package/dist/cli/auth/types.d.ts +0 -11
- package/dist/cli/auth/types.d.ts.map +0 -1
- package/dist/cli/auth/types.js +0 -1
- package/dist/cli/cloud-chat.d.ts +0 -18
- package/dist/cli/cloud-chat.d.ts.map +0 -1
- package/dist/cli/cloud-chat.js +0 -734
- package/dist/cli/commands/auth/index.d.ts +0 -4
- package/dist/cli/commands/auth/index.d.ts.map +0 -1
- package/dist/cli/commands/auth/index.js +0 -4
- package/dist/cli/commands/auth/login.d.ts +0 -12
- package/dist/cli/commands/auth/login.d.ts.map +0 -1
- package/dist/cli/commands/auth/login.js +0 -153
- package/dist/cli/commands/auth/logout.d.ts +0 -5
- package/dist/cli/commands/auth/logout.d.ts.map +0 -1
- package/dist/cli/commands/auth/logout.js +0 -81
- package/dist/cli/commands/auth/register.d.ts +0 -3
- package/dist/cli/commands/auth/register.d.ts.map +0 -1
- package/dist/cli/commands/auth/register.js +0 -96
- package/dist/cli/commands/auth/status.d.ts +0 -2
- package/dist/cli/commands/auth/status.d.ts.map +0 -1
- package/dist/cli/commands/auth/status.js +0 -22
- package/dist/cli/commands/billing/index.d.ts +0 -2
- package/dist/cli/commands/billing/index.d.ts.map +0 -1
- package/dist/cli/commands/billing/index.js +0 -2
- package/dist/cli/commands/billing/register.d.ts +0 -3
- package/dist/cli/commands/billing/register.d.ts.map +0 -1
- package/dist/cli/commands/billing/register.js +0 -20
- package/dist/cli/commands/billing/status.d.ts +0 -8
- package/dist/cli/commands/billing/status.d.ts.map +0 -1
- package/dist/cli/commands/billing/status.js +0 -71
- package/dist/cli/commands/cloud/discovery.d.ts +0 -17
- package/dist/cli/commands/cloud/discovery.d.ts.map +0 -1
- package/dist/cli/commands/cloud/discovery.js +0 -88
- package/dist/cli/commands/deploy/client.d.ts +0 -113
- package/dist/cli/commands/deploy/client.d.ts.map +0 -1
- package/dist/cli/commands/deploy/client.js +0 -519
- package/dist/cli/commands/deploy/config.d.ts +0 -37
- package/dist/cli/commands/deploy/config.d.ts.map +0 -1
- package/dist/cli/commands/deploy/config.js +0 -144
- package/dist/cli/commands/deploy/entry-agent.d.ts +0 -3
- package/dist/cli/commands/deploy/entry-agent.d.ts.map +0 -1
- package/dist/cli/commands/deploy/entry-agent.js +0 -70
- package/dist/cli/commands/deploy/index.d.ts +0 -12
- package/dist/cli/commands/deploy/index.d.ts.map +0 -1
- package/dist/cli/commands/deploy/index.js +0 -370
- package/dist/cli/commands/deploy/links.d.ts +0 -3
- package/dist/cli/commands/deploy/links.d.ts.map +0 -1
- package/dist/cli/commands/deploy/links.js +0 -53
- package/dist/cli/commands/deploy/register.d.ts +0 -6
- package/dist/cli/commands/deploy/register.d.ts.map +0 -1
- package/dist/cli/commands/deploy/register.js +0 -128
- package/dist/cli/commands/deploy/snapshot.d.ts +0 -12
- package/dist/cli/commands/deploy/snapshot.d.ts.map +0 -1
- package/dist/cli/commands/deploy/snapshot.js +0 -76
- package/dist/cli/commands/deploy/state.d.ts +0 -13
- package/dist/cli/commands/deploy/state.d.ts.map +0 -1
- package/dist/cli/commands/deploy/state.js +0 -122
- package/dist/cli/commands/span/register.d.ts +0 -6
- package/dist/cli/commands/span/register.d.ts.map +0 -1
- package/dist/cli/commands/span/register.js +0 -25
- package/dist/cli/commands/trace/client.d.ts +0 -98
- package/dist/cli/commands/trace/client.d.ts.map +0 -1
- package/dist/cli/commands/trace/client.js +0 -150
- package/dist/cli/commands/trace/format.d.ts +0 -5
- package/dist/cli/commands/trace/format.d.ts.map +0 -1
- package/dist/cli/commands/trace/format.js +0 -58
- package/dist/cli/commands/trace/index.d.ts +0 -21
- package/dist/cli/commands/trace/index.d.ts.map +0 -1
- package/dist/cli/commands/trace/index.js +0 -49
- package/dist/cli/commands/trace/register.d.ts +0 -6
- package/dist/cli/commands/trace/register.d.ts.map +0 -1
- package/dist/cli/commands/trace/register.js +0 -71
- package/dist/webui/assets/index-DEfRFmFT.js +0 -1667
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { ExitSignal, safeExit, withAnalytics } from '../../../analytics/wrapper.js';
|
|
2
|
-
export function registerDeployCommand({ program }) {
|
|
3
|
-
const deployCommand = program
|
|
4
|
-
.command('deploy')
|
|
5
|
-
.description('Deploy the current workspace to a cloud sandbox');
|
|
6
|
-
deployCommand.addHelpText('after', `
|
|
7
|
-
Examples:
|
|
8
|
-
$ dexto deploy
|
|
9
|
-
$ dexto deploy list
|
|
10
|
-
$ dexto deploy chat
|
|
11
|
-
$ dexto deploy chat sbx_123
|
|
12
|
-
$ dexto deploy open
|
|
13
|
-
$ dexto deploy status
|
|
14
|
-
$ dexto deploy stop
|
|
15
|
-
$ dexto deploy delete
|
|
16
|
-
`);
|
|
17
|
-
deployCommand.option('--no-interactive', 'Disable interactive prompts').action(withAnalytics('deploy', async (options) => {
|
|
18
|
-
try {
|
|
19
|
-
const { handleDeployCommand } = await import('./index.js');
|
|
20
|
-
await handleDeployCommand(options);
|
|
21
|
-
safeExit('deploy', 0);
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
if (err instanceof ExitSignal)
|
|
25
|
-
throw err;
|
|
26
|
-
console.error(`❌ dexto deploy command failed: ${err}`);
|
|
27
|
-
safeExit('deploy', 1, 'error');
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
deployCommand
|
|
31
|
-
.command('chat')
|
|
32
|
-
.description('Start Ink CLI chat against a selected or explicit cloud agent')
|
|
33
|
-
.argument('[cloudAgentId]', 'Cloud agent ID (omit to choose from your available cloud agents)')
|
|
34
|
-
.action(withAnalytics('deploy chat', async (cloudAgentId) => {
|
|
35
|
-
try {
|
|
36
|
-
const { handleDeployChatCommand } = await import('./index.js');
|
|
37
|
-
await handleDeployChatCommand(cloudAgentId);
|
|
38
|
-
safeExit('deploy chat', 0);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
if (err instanceof ExitSignal)
|
|
42
|
-
throw err;
|
|
43
|
-
console.error(`❌ dexto deploy chat command failed: ${err}`);
|
|
44
|
-
safeExit('deploy chat', 1, 'error');
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
deployCommand
|
|
48
|
-
.command('list')
|
|
49
|
-
.description('List cloud deployments for your account')
|
|
50
|
-
.action(withAnalytics('deploy list', async () => {
|
|
51
|
-
try {
|
|
52
|
-
const { handleDeployListCommand } = await import('./index.js');
|
|
53
|
-
await handleDeployListCommand();
|
|
54
|
-
safeExit('deploy list', 0);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
if (err instanceof ExitSignal)
|
|
58
|
-
throw err;
|
|
59
|
-
console.error(`❌ dexto deploy list command failed: ${err}`);
|
|
60
|
-
safeExit('deploy list', 1, 'error');
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
deployCommand
|
|
64
|
-
.command('open')
|
|
65
|
-
.description('Open the linked cloud deployment in the dashboard')
|
|
66
|
-
.action(withAnalytics('deploy open', async () => {
|
|
67
|
-
try {
|
|
68
|
-
const { handleDeployOpenCommand } = await import('./index.js');
|
|
69
|
-
await handleDeployOpenCommand();
|
|
70
|
-
safeExit('deploy open', 0);
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
if (err instanceof ExitSignal)
|
|
74
|
-
throw err;
|
|
75
|
-
console.error(`❌ dexto deploy open command failed: ${err}`);
|
|
76
|
-
safeExit('deploy open', 1, 'error');
|
|
77
|
-
}
|
|
78
|
-
}));
|
|
79
|
-
deployCommand
|
|
80
|
-
.command('status')
|
|
81
|
-
.description('Show the linked cloud deployment for the current workspace')
|
|
82
|
-
.action(withAnalytics('deploy status', async () => {
|
|
83
|
-
try {
|
|
84
|
-
const { handleDeployStatusCommand } = await import('./index.js');
|
|
85
|
-
await handleDeployStatusCommand();
|
|
86
|
-
safeExit('deploy status', 0);
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
if (err instanceof ExitSignal)
|
|
90
|
-
throw err;
|
|
91
|
-
console.error(`❌ dexto deploy status command failed: ${err}`);
|
|
92
|
-
safeExit('deploy status', 1, 'error');
|
|
93
|
-
}
|
|
94
|
-
}));
|
|
95
|
-
deployCommand
|
|
96
|
-
.command('stop')
|
|
97
|
-
.description('Stop the linked cloud sandbox for the current workspace')
|
|
98
|
-
.action(withAnalytics('deploy stop', async () => {
|
|
99
|
-
try {
|
|
100
|
-
const { handleDeployStopCommand } = await import('./index.js');
|
|
101
|
-
await handleDeployStopCommand();
|
|
102
|
-
safeExit('deploy stop', 0);
|
|
103
|
-
}
|
|
104
|
-
catch (err) {
|
|
105
|
-
if (err instanceof ExitSignal)
|
|
106
|
-
throw err;
|
|
107
|
-
console.error(`❌ dexto deploy stop command failed: ${err}`);
|
|
108
|
-
safeExit('deploy stop', 1, 'error');
|
|
109
|
-
}
|
|
110
|
-
}));
|
|
111
|
-
deployCommand
|
|
112
|
-
.command('delete')
|
|
113
|
-
.description('Delete the linked cloud deployment and unlink this workspace')
|
|
114
|
-
.option('--no-interactive', 'Disable confirmation prompts')
|
|
115
|
-
.action(withAnalytics('deploy delete', async (options) => {
|
|
116
|
-
try {
|
|
117
|
-
const { handleDeployDeleteCommand } = await import('./index.js');
|
|
118
|
-
await handleDeployDeleteCommand(options);
|
|
119
|
-
safeExit('deploy delete', 0);
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
if (err instanceof ExitSignal)
|
|
123
|
-
throw err;
|
|
124
|
-
console.error(`❌ dexto deploy delete command failed: ${err}`);
|
|
125
|
-
safeExit('deploy delete', 1, 'error');
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface WorkspaceSnapshotResult {
|
|
2
|
-
archivePath: string;
|
|
3
|
-
sizeBytes: number;
|
|
4
|
-
cleanup: () => Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare function shouldExcludeRelativePath(relativePath: string, excludePatterns: string[]): boolean;
|
|
7
|
-
export declare function createWorkspaceSnapshot(input: {
|
|
8
|
-
workspaceRoot: string;
|
|
9
|
-
workspaceAgentPath?: string;
|
|
10
|
-
exclude: string[];
|
|
11
|
-
}): Promise<WorkspaceSnapshotResult>;
|
|
12
|
-
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/snapshot.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAiBD,wBAAgB,yBAAyB,CACrC,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EAAE,GAC1B,OAAO,CAoBT;AAED,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAiDnC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import os from 'os';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { minimatch } from 'minimatch';
|
|
5
|
-
import { create as createTar } from 'tar';
|
|
6
|
-
import { normalizeWorkspaceRelativePath } from './config.js';
|
|
7
|
-
function normalizeArchivePath(value) {
|
|
8
|
-
return value
|
|
9
|
-
.replace(/\\/g, '/')
|
|
10
|
-
.replace(/^\.\/+/, '')
|
|
11
|
-
.replace(/\/+$/, '');
|
|
12
|
-
}
|
|
13
|
-
function normalizeExcludePattern(value) {
|
|
14
|
-
return value
|
|
15
|
-
.trim()
|
|
16
|
-
.replace(/\\/g, '/')
|
|
17
|
-
.replace(/^\.\/+/, '')
|
|
18
|
-
.replace(/\/+$/, '');
|
|
19
|
-
}
|
|
20
|
-
export function shouldExcludeRelativePath(relativePath, excludePatterns) {
|
|
21
|
-
const normalizedRelativePath = normalizeWorkspaceRelativePath(relativePath);
|
|
22
|
-
const basename = path.posix.basename(normalizedRelativePath);
|
|
23
|
-
return excludePatterns.some((pattern) => {
|
|
24
|
-
const normalizedPattern = normalizeExcludePattern(pattern);
|
|
25
|
-
if (normalizedPattern.length === 0) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (normalizedRelativePath === normalizedPattern ||
|
|
29
|
-
normalizedRelativePath.startsWith(`${normalizedPattern}/`)) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return (minimatch(normalizedRelativePath, normalizedPattern, { dot: true }) ||
|
|
33
|
-
minimatch(basename, normalizedPattern, { dot: true }));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export async function createWorkspaceSnapshot(input) {
|
|
37
|
-
const workspaceRoot = path.resolve(input.workspaceRoot);
|
|
38
|
-
const workspaceAgentPath = typeof input.workspaceAgentPath === 'string'
|
|
39
|
-
? normalizeWorkspaceRelativePath(input.workspaceAgentPath)
|
|
40
|
-
: null;
|
|
41
|
-
if (workspaceAgentPath && shouldExcludeRelativePath(workspaceAgentPath, input.exclude)) {
|
|
42
|
-
throw new Error(`Deploy config excludes the selected workspace agent: ${workspaceAgentPath}. Remove it from exclude before deploying.`);
|
|
43
|
-
}
|
|
44
|
-
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'dexto-deploy-'));
|
|
45
|
-
const archivePath = path.join(tempDir, 'workspace.tar.gz');
|
|
46
|
-
const topLevelEntries = await fs.readdir(workspaceRoot);
|
|
47
|
-
try {
|
|
48
|
-
await createTar({
|
|
49
|
-
cwd: workspaceRoot,
|
|
50
|
-
file: archivePath,
|
|
51
|
-
gzip: true,
|
|
52
|
-
portable: true,
|
|
53
|
-
noMtime: true,
|
|
54
|
-
prefix: 'workspace',
|
|
55
|
-
filter: (entryPath) => {
|
|
56
|
-
const relativePath = normalizeArchivePath(entryPath);
|
|
57
|
-
if (relativePath.length === 0) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return !shouldExcludeRelativePath(relativePath, input.exclude);
|
|
61
|
-
},
|
|
62
|
-
}, topLevelEntries);
|
|
63
|
-
const stats = await fs.stat(archivePath);
|
|
64
|
-
return {
|
|
65
|
-
archivePath,
|
|
66
|
-
sizeBytes: stats.size,
|
|
67
|
-
cleanup: async () => {
|
|
68
|
-
await fs.rm(tempDir, { recursive: true, force: true });
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
await fs.rm(tempDir, { recursive: true, force: true });
|
|
74
|
-
throw error;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const DeployLinkSchema: z.ZodObject<{
|
|
3
|
-
cloudAgentId: z.ZodString;
|
|
4
|
-
agentUrl: z.ZodOptional<z.ZodString>;
|
|
5
|
-
updatedAt: z.ZodString;
|
|
6
|
-
}, z.core.$strict>;
|
|
7
|
-
export type DeployLink = z.output<typeof DeployLinkSchema>;
|
|
8
|
-
type DeployLinkInput = Pick<z.input<typeof DeployLinkSchema>, 'cloudAgentId' | 'agentUrl'>;
|
|
9
|
-
export declare function loadWorkspaceDeployLink(workspaceRoot: string): Promise<DeployLink | null>;
|
|
10
|
-
export declare function saveWorkspaceDeployLink(workspaceRoot: string, link: DeployLinkInput): Promise<void>;
|
|
11
|
-
export declare function removeWorkspaceDeployLink(workspaceRoot: string): Promise<void>;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,gBAAgB;;;;kBAMT,CAAC;AASd,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC3D,KAAK,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,CAAC;AA4F3F,wBAAsB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAG/F;AAED,wBAAsB,uBAAuB,CACzC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,eAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpF"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { setTimeout as delay } from 'timers/promises';
|
|
4
|
-
import { getDextoGlobalPath } from '@dexto/core';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
const DEPLOY_LINKS_FILENAME = 'links.json';
|
|
7
|
-
const DEPLOY_LOCK_SUFFIX = '.lock';
|
|
8
|
-
const DEPLOY_LOCK_RETRY_MS = 25;
|
|
9
|
-
const DEPLOY_LOCK_TIMEOUT_MS = 5_000;
|
|
10
|
-
const DEPLOY_LOCK_STALE_MS = DEPLOY_LOCK_TIMEOUT_MS;
|
|
11
|
-
const DeployLinkSchema = z
|
|
12
|
-
.object({
|
|
13
|
-
cloudAgentId: z.string().trim().min(1),
|
|
14
|
-
agentUrl: z.string().trim().min(1).optional(),
|
|
15
|
-
updatedAt: z.string().datetime(),
|
|
16
|
-
})
|
|
17
|
-
.strict();
|
|
18
|
-
const DeployStateSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
version: z.literal(1).default(1),
|
|
21
|
-
links: z.record(z.string(), DeployLinkSchema).default({}),
|
|
22
|
-
})
|
|
23
|
-
.strict();
|
|
24
|
-
function getDeployLinksPath() {
|
|
25
|
-
return getDextoGlobalPath('deployments', DEPLOY_LINKS_FILENAME);
|
|
26
|
-
}
|
|
27
|
-
function getDeployLockPath(filePath) {
|
|
28
|
-
return `${filePath}${DEPLOY_LOCK_SUFFIX}`;
|
|
29
|
-
}
|
|
30
|
-
function normalizeWorkspaceKey(workspaceRoot) {
|
|
31
|
-
return path.resolve(workspaceRoot);
|
|
32
|
-
}
|
|
33
|
-
async function loadDeployStateFromPath(filePath) {
|
|
34
|
-
if (!existsSync(filePath)) {
|
|
35
|
-
return DeployStateSchema.parse({ version: 1, links: {} });
|
|
36
|
-
}
|
|
37
|
-
const raw = await fs.readFile(filePath, 'utf8');
|
|
38
|
-
return DeployStateSchema.parse(JSON.parse(raw));
|
|
39
|
-
}
|
|
40
|
-
async function loadDeployState() {
|
|
41
|
-
return loadDeployStateFromPath(getDeployLinksPath());
|
|
42
|
-
}
|
|
43
|
-
async function writeDeployStateAtomic(filePath, state) {
|
|
44
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
45
|
-
const tempPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
46
|
-
try {
|
|
47
|
-
await fs.writeFile(tempPath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
|
|
48
|
-
await fs.rename(tempPath, filePath);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
await fs.rm(tempPath, { force: true }).catch(() => undefined);
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async function reclaimStaleDeployLock(lockPath) {
|
|
56
|
-
try {
|
|
57
|
-
const stat = await fs.stat(lockPath);
|
|
58
|
-
if (Date.now() - stat.mtimeMs < DEPLOY_LOCK_STALE_MS) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
await fs.rm(lockPath, { recursive: true, force: true });
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
if (error.code === 'ENOENT') {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async function withDeployStateLock(operation) {
|
|
72
|
-
const filePath = getDeployLinksPath();
|
|
73
|
-
const lockPath = getDeployLockPath(filePath);
|
|
74
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
75
|
-
const deadline = Date.now() + DEPLOY_LOCK_TIMEOUT_MS;
|
|
76
|
-
for (;;) {
|
|
77
|
-
try {
|
|
78
|
-
await fs.mkdir(lockPath);
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (error.code !== 'EEXIST') {
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
if (await reclaimStaleDeployLock(lockPath)) {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (Date.now() >= deadline) {
|
|
89
|
-
throw new Error(`Timed out waiting for deploy state lock: ${lockPath}`);
|
|
90
|
-
}
|
|
91
|
-
await delay(DEPLOY_LOCK_RETRY_MS);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
return await operation(filePath);
|
|
96
|
-
}
|
|
97
|
-
finally {
|
|
98
|
-
await fs.rm(lockPath, { recursive: true, force: true });
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
export async function loadWorkspaceDeployLink(workspaceRoot) {
|
|
102
|
-
const state = await loadDeployState();
|
|
103
|
-
return state.links[normalizeWorkspaceKey(workspaceRoot)] ?? null;
|
|
104
|
-
}
|
|
105
|
-
export async function saveWorkspaceDeployLink(workspaceRoot, link) {
|
|
106
|
-
await withDeployStateLock(async (filePath) => {
|
|
107
|
-
const state = await loadDeployStateFromPath(filePath);
|
|
108
|
-
state.links[normalizeWorkspaceKey(workspaceRoot)] = DeployLinkSchema.parse({
|
|
109
|
-
cloudAgentId: link.cloudAgentId,
|
|
110
|
-
agentUrl: link.agentUrl,
|
|
111
|
-
updatedAt: new Date().toISOString(),
|
|
112
|
-
});
|
|
113
|
-
await writeDeployStateAtomic(filePath, state);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
export async function removeWorkspaceDeployLink(workspaceRoot) {
|
|
117
|
-
await withDeployStateLock(async (filePath) => {
|
|
118
|
-
const state = await loadDeployStateFromPath(filePath);
|
|
119
|
-
delete state.links[normalizeWorkspaceKey(workspaceRoot)];
|
|
120
|
-
await writeDeployStateAtomic(filePath, state);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/span/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,0BAA0B,GAAG,IAAI,CAwBjF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
|
|
2
|
-
export function registerSpanCommand({ program }) {
|
|
3
|
-
const span = program.command('span').description('Inspect hosted run spans from Dexto Cloud');
|
|
4
|
-
span.command('list <runId>')
|
|
5
|
-
.description('List spans for a hosted run')
|
|
6
|
-
.option('--json', 'Print the raw span list response as JSON')
|
|
7
|
-
.option('--limit <count>', 'Maximum number of spans to return')
|
|
8
|
-
.option('--name <spanName>', 'Filter to an exact span name')
|
|
9
|
-
.option('--platform-url <url>', 'Use a custom Dexto platform URL')
|
|
10
|
-
.option('--sort <sort>', 'Sort by started_at or duration')
|
|
11
|
-
.option('--status <status>', 'Filter to a span status')
|
|
12
|
-
.action(withAnalytics('span:list', async (runId, options) => {
|
|
13
|
-
try {
|
|
14
|
-
const { handleSpanListCommand } = await import('../trace/index.js');
|
|
15
|
-
await handleSpanListCommand(runId, options);
|
|
16
|
-
safeExit('span:list', 0);
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
if (err instanceof ExitSignal)
|
|
20
|
-
throw err;
|
|
21
|
-
console.error(`❌ dexto span list command failed: ${err}`);
|
|
22
|
-
safeExit('span:list', 1, 'error');
|
|
23
|
-
}
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const RunTraceSpanSchema: z.ZodObject<{
|
|
3
|
-
attributes: z.ZodUnknown;
|
|
4
|
-
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
5
|
-
endedAt: z.ZodNullable<z.ZodString>;
|
|
6
|
-
errorCode: z.ZodNullable<z.ZodString>;
|
|
7
|
-
errorMessage: z.ZodNullable<z.ZodString>;
|
|
8
|
-
id: z.ZodString;
|
|
9
|
-
name: z.ZodString;
|
|
10
|
-
parentSpanId: z.ZodNullable<z.ZodString>;
|
|
11
|
-
runAttemptId: z.ZodNullable<z.ZodString>;
|
|
12
|
-
runId: z.ZodString;
|
|
13
|
-
sessionId: z.ZodNullable<z.ZodString>;
|
|
14
|
-
spanId: z.ZodString;
|
|
15
|
-
startedAt: z.ZodString;
|
|
16
|
-
status: z.ZodEnum<{
|
|
17
|
-
failed: "failed";
|
|
18
|
-
cancelled: "cancelled";
|
|
19
|
-
completed: "completed";
|
|
20
|
-
running: "running";
|
|
21
|
-
}>;
|
|
22
|
-
traceId: z.ZodString;
|
|
23
|
-
}, z.core.$loose>;
|
|
24
|
-
declare const RunTraceSchema: z.ZodObject<{
|
|
25
|
-
events: z.ZodArray<z.ZodObject<{
|
|
26
|
-
attributes: z.ZodUnknown;
|
|
27
|
-
eventId: z.ZodString;
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
occurredAt: z.ZodString;
|
|
30
|
-
runId: z.ZodString;
|
|
31
|
-
runSpanId: z.ZodString;
|
|
32
|
-
}, z.core.$loose>>;
|
|
33
|
-
spans: z.ZodArray<z.ZodObject<{
|
|
34
|
-
attributes: z.ZodUnknown;
|
|
35
|
-
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
36
|
-
endedAt: z.ZodNullable<z.ZodString>;
|
|
37
|
-
errorCode: z.ZodNullable<z.ZodString>;
|
|
38
|
-
errorMessage: z.ZodNullable<z.ZodString>;
|
|
39
|
-
id: z.ZodString;
|
|
40
|
-
name: z.ZodString;
|
|
41
|
-
parentSpanId: z.ZodNullable<z.ZodString>;
|
|
42
|
-
runAttemptId: z.ZodNullable<z.ZodString>;
|
|
43
|
-
runId: z.ZodString;
|
|
44
|
-
sessionId: z.ZodNullable<z.ZodString>;
|
|
45
|
-
spanId: z.ZodString;
|
|
46
|
-
startedAt: z.ZodString;
|
|
47
|
-
status: z.ZodEnum<{
|
|
48
|
-
failed: "failed";
|
|
49
|
-
cancelled: "cancelled";
|
|
50
|
-
completed: "completed";
|
|
51
|
-
running: "running";
|
|
52
|
-
}>;
|
|
53
|
-
traceId: z.ZodString;
|
|
54
|
-
}, z.core.$loose>>;
|
|
55
|
-
}, z.core.$loose>;
|
|
56
|
-
declare const RunTraceSummarySchema: z.ZodObject<{
|
|
57
|
-
durationMs: z.ZodNumber;
|
|
58
|
-
errorCount: z.ZodNumber;
|
|
59
|
-
eventCount: z.ZodNumber;
|
|
60
|
-
firstSpanStartedAt: z.ZodString;
|
|
61
|
-
lastSpanStartedAt: z.ZodString;
|
|
62
|
-
runId: z.ZodString;
|
|
63
|
-
sessionId: z.ZodString;
|
|
64
|
-
spanCount: z.ZodNumber;
|
|
65
|
-
spanNames: z.ZodArray<z.ZodString>;
|
|
66
|
-
status: z.ZodString;
|
|
67
|
-
}, z.core.$loose>;
|
|
68
|
-
export type RunTrace = z.output<typeof RunTraceSchema>;
|
|
69
|
-
export type RunTraceSpan = z.output<typeof RunTraceSpanSchema>;
|
|
70
|
-
export type RunTraceSummary = z.output<typeof RunTraceSummarySchema>;
|
|
71
|
-
export interface TraceClientOptions {
|
|
72
|
-
platformUrl?: string | undefined;
|
|
73
|
-
}
|
|
74
|
-
export interface RequestOptions {
|
|
75
|
-
signal?: AbortSignal | undefined;
|
|
76
|
-
}
|
|
77
|
-
export interface FetchRunTraceOptions extends RequestOptions {
|
|
78
|
-
}
|
|
79
|
-
export interface ListRunTracesOptions extends RequestOptions {
|
|
80
|
-
limit?: number | undefined;
|
|
81
|
-
period?: string | undefined;
|
|
82
|
-
sessionId?: string | undefined;
|
|
83
|
-
status?: string | undefined;
|
|
84
|
-
}
|
|
85
|
-
export interface ListRunSpansOptions extends RequestOptions {
|
|
86
|
-
limit?: number | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
|
-
sort?: 'started_at' | 'duration' | undefined;
|
|
89
|
-
status?: string | undefined;
|
|
90
|
-
}
|
|
91
|
-
export declare function resolveTracePlatformUrl(platformUrl?: string): string;
|
|
92
|
-
export declare function createTraceClient(options?: TraceClientOptions): {
|
|
93
|
-
fetchRunTrace(runId: string, fetchOptions?: FetchRunTraceOptions): Promise<RunTrace>;
|
|
94
|
-
listRunSpans(runId: string, listOptions?: ListRunSpansOptions): Promise<RunTraceSpan[]>;
|
|
95
|
-
listRunTraces(listOptions?: ListRunTracesOptions): Promise<RunTraceSummary[]>;
|
|
96
|
-
};
|
|
97
|
-
export {};
|
|
98
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/trace/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;iBAkBN,CAAC;AAanB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKF,CAAC;AAQnB,QAAA,MAAM,qBAAqB;;;;;;;;;;;iBAaT,CAAC;AAcnB,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;CAAG;AAE/D,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IACxD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACvD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAOpE;AAiDD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB;yBAsB/C,MAAM,iBACC,oBAAoB,GACnC,OAAO,CAAC,QAAQ,CAAC;wBAUT,MAAM,gBACA,mBAAmB,GACjC,OAAO,CAAC,YAAY,EAAE,CAAC;gCAYO,oBAAoB,GAAQ,OAAO,CAAC,eAAe,EAAE,CAAC;EAY9F"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { DEXTO_PLATFORM_URL } from '../../auth/constants.js';
|
|
3
|
-
import { getDextoApiKey } from '../../auth/service.js';
|
|
4
|
-
const TRACE_REQUEST_TIMEOUT_MS = 10_000;
|
|
5
|
-
const RunTraceSpanStatusSchema = z.enum(['running', 'completed', 'failed', 'cancelled']);
|
|
6
|
-
const RunTraceSpanSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
attributes: z.unknown(),
|
|
9
|
-
durationMs: z.number().nullable(),
|
|
10
|
-
endedAt: z.string().nullable(),
|
|
11
|
-
errorCode: z.string().nullable(),
|
|
12
|
-
errorMessage: z.string().nullable(),
|
|
13
|
-
id: z.string(),
|
|
14
|
-
name: z.string(),
|
|
15
|
-
parentSpanId: z.string().nullable(),
|
|
16
|
-
runAttemptId: z.string().nullable(),
|
|
17
|
-
runId: z.string(),
|
|
18
|
-
sessionId: z.string().nullable(),
|
|
19
|
-
spanId: z.string(),
|
|
20
|
-
startedAt: z.string(),
|
|
21
|
-
status: RunTraceSpanStatusSchema,
|
|
22
|
-
traceId: z.string(),
|
|
23
|
-
})
|
|
24
|
-
.passthrough();
|
|
25
|
-
const RunTraceEventSchema = z
|
|
26
|
-
.object({
|
|
27
|
-
attributes: z.unknown(),
|
|
28
|
-
eventId: z.string(),
|
|
29
|
-
name: z.string(),
|
|
30
|
-
occurredAt: z.string(),
|
|
31
|
-
runId: z.string(),
|
|
32
|
-
runSpanId: z.string(),
|
|
33
|
-
})
|
|
34
|
-
.passthrough();
|
|
35
|
-
const RunTraceSchema = z
|
|
36
|
-
.object({
|
|
37
|
-
events: z.array(RunTraceEventSchema),
|
|
38
|
-
spans: z.array(RunTraceSpanSchema),
|
|
39
|
-
})
|
|
40
|
-
.passthrough();
|
|
41
|
-
const RunTraceResponseSchema = z
|
|
42
|
-
.object({
|
|
43
|
-
trace: RunTraceSchema,
|
|
44
|
-
})
|
|
45
|
-
.passthrough();
|
|
46
|
-
const RunTraceSummarySchema = z
|
|
47
|
-
.object({
|
|
48
|
-
durationMs: z.number(),
|
|
49
|
-
errorCount: z.number(),
|
|
50
|
-
eventCount: z.number(),
|
|
51
|
-
firstSpanStartedAt: z.string(),
|
|
52
|
-
lastSpanStartedAt: z.string(),
|
|
53
|
-
runId: z.string(),
|
|
54
|
-
sessionId: z.string(),
|
|
55
|
-
spanCount: z.number(),
|
|
56
|
-
spanNames: z.array(z.string()),
|
|
57
|
-
status: z.string(),
|
|
58
|
-
})
|
|
59
|
-
.passthrough();
|
|
60
|
-
const RunTraceListResponseSchema = z
|
|
61
|
-
.object({
|
|
62
|
-
traces: z.array(RunTraceSummarySchema),
|
|
63
|
-
})
|
|
64
|
-
.passthrough();
|
|
65
|
-
const RunSpansResponseSchema = z
|
|
66
|
-
.object({
|
|
67
|
-
spans: z.array(RunTraceSpanSchema),
|
|
68
|
-
})
|
|
69
|
-
.passthrough();
|
|
70
|
-
export function resolveTracePlatformUrl(platformUrl) {
|
|
71
|
-
const rawUrl = platformUrl?.trim() || DEXTO_PLATFORM_URL;
|
|
72
|
-
if (rawUrl.trim().length === 0) {
|
|
73
|
-
throw new Error('Dexto platform URL is empty.');
|
|
74
|
-
}
|
|
75
|
-
return rawUrl.replace(/\/+$/, '');
|
|
76
|
-
}
|
|
77
|
-
async function resolveTraceApiKey() {
|
|
78
|
-
const apiKey = await getDextoApiKey();
|
|
79
|
-
if (!apiKey?.trim()) {
|
|
80
|
-
throw new Error('Authentication required. Run `dexto login` before using `dexto trace`.');
|
|
81
|
-
}
|
|
82
|
-
return apiKey.trim();
|
|
83
|
-
}
|
|
84
|
-
async function parseJsonResponse(response) {
|
|
85
|
-
const contentType = response.headers.get('content-type') ?? '';
|
|
86
|
-
if (!contentType.toLowerCase().includes('application/json')) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
return response.json().catch(() => null);
|
|
90
|
-
}
|
|
91
|
-
function formatHttpFailure(status, payload) {
|
|
92
|
-
if (payload && typeof payload === 'object' && 'error' in payload) {
|
|
93
|
-
return `${status} ${JSON.stringify(payload)}`;
|
|
94
|
-
}
|
|
95
|
-
return `${status}`;
|
|
96
|
-
}
|
|
97
|
-
function appendOptionalSearchParam(url, key, value) {
|
|
98
|
-
if (value === undefined) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
url.searchParams.set(key, String(value));
|
|
102
|
-
}
|
|
103
|
-
function createRequestSignal(signal) {
|
|
104
|
-
const timeoutSignal = AbortSignal.timeout(TRACE_REQUEST_TIMEOUT_MS);
|
|
105
|
-
if (!signal) {
|
|
106
|
-
return timeoutSignal;
|
|
107
|
-
}
|
|
108
|
-
return AbortSignal.any([signal, timeoutSignal]);
|
|
109
|
-
}
|
|
110
|
-
export function createTraceClient(options = {}) {
|
|
111
|
-
const platformBaseUrl = resolveTracePlatformUrl(options.platformUrl);
|
|
112
|
-
async function fetchJson(path, fetchOptions = {}) {
|
|
113
|
-
const response = await fetch(`${platformBaseUrl}${path}`, {
|
|
114
|
-
method: 'GET',
|
|
115
|
-
headers: {
|
|
116
|
-
Authorization: `Bearer ${await resolveTraceApiKey()}`,
|
|
117
|
-
},
|
|
118
|
-
signal: createRequestSignal(fetchOptions.signal),
|
|
119
|
-
});
|
|
120
|
-
const payload = await parseJsonResponse(response);
|
|
121
|
-
if (!response.ok) {
|
|
122
|
-
throw new Error(`Trace request failed: ${formatHttpFailure(response.status, payload)}`);
|
|
123
|
-
}
|
|
124
|
-
return payload;
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
async fetchRunTrace(runId, fetchOptions = {}) {
|
|
128
|
-
const payload = await fetchJson(`/api/runs/${encodeURIComponent(runId)}/trace`, fetchOptions);
|
|
129
|
-
return RunTraceResponseSchema.parse(payload).trace;
|
|
130
|
-
},
|
|
131
|
-
async listRunSpans(runId, listOptions = {}) {
|
|
132
|
-
const url = new URL(`${platformBaseUrl}/api/runs/${encodeURIComponent(runId)}/spans`);
|
|
133
|
-
appendOptionalSearchParam(url, 'limit', listOptions.limit);
|
|
134
|
-
appendOptionalSearchParam(url, 'name', listOptions.name);
|
|
135
|
-
appendOptionalSearchParam(url, 'sort', listOptions.sort);
|
|
136
|
-
appendOptionalSearchParam(url, 'status', listOptions.status);
|
|
137
|
-
const payload = await fetchJson(`${url.pathname}${url.search}`, listOptions);
|
|
138
|
-
return RunSpansResponseSchema.parse(payload).spans;
|
|
139
|
-
},
|
|
140
|
-
async listRunTraces(listOptions = {}) {
|
|
141
|
-
const url = new URL(`${platformBaseUrl}/api/runs/traces`);
|
|
142
|
-
appendOptionalSearchParam(url, 'limit', listOptions.limit);
|
|
143
|
-
appendOptionalSearchParam(url, 'period', listOptions.period);
|
|
144
|
-
appendOptionalSearchParam(url, 'sessionId', listOptions.sessionId);
|
|
145
|
-
appendOptionalSearchParam(url, 'status', listOptions.status);
|
|
146
|
-
const payload = await fetchJson(`${url.pathname}${url.search}`, listOptions);
|
|
147
|
-
return RunTraceListResponseSchema.parse(payload).traces;
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RunTrace, RunTraceSpan, RunTraceSummary } from './client.js';
|
|
2
|
-
export declare function formatTraceSummary(runId: string, trace: RunTrace): string;
|
|
3
|
-
export declare function formatTraceList(traces: RunTraceSummary[]): string;
|
|
4
|
-
export declare function formatSpanList(runId: string, spans: RunTraceSpan[]): string;
|
|
5
|
-
//# sourceMappingURL=format.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/trace/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAc3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,CAsBzE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAkBjE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CAoB3E"}
|