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
|
@@ -127,8 +127,6 @@ permissions:
|
|
|
127
127
|
- plan_create # Create plan without approval
|
|
128
128
|
- plan_read # Read plan without approval
|
|
129
129
|
- plan_update # Update plan without approval
|
|
130
|
-
- wait_for # Wait for background tasks without approval
|
|
131
|
-
- check_task # Check background tasks without approval
|
|
132
130
|
|
|
133
131
|
# Compaction configuration - automatically summarizes conversation when context is full
|
|
134
132
|
compaction:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
export interface AuditRow {
|
|
3
|
+
command: string;
|
|
4
|
+
json: boolean;
|
|
5
|
+
dryRun: boolean;
|
|
6
|
+
nonInteractiveFlag: boolean;
|
|
7
|
+
examples: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function auditCommander(program: Command): AuditRow[];
|
|
10
|
+
export declare function auditCloud(commands: readonly import('./cloud/command.js').Command[]): AuditRow[];
|
|
11
|
+
export declare function auditProgram(program: Command, commands: readonly import('./cloud/command.js').Command[]): AuditRow[];
|
|
12
|
+
//# sourceMappingURL=agent-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-audit.d.ts","sourceRoot":"","sources":["../../src/cli/agent-audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,EAAE,CAiC3D;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,OAAO,oBAAoB,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAQhG;AAED,wBAAgB,YAAY,CACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,SAAS,OAAO,oBAAoB,EAAE,OAAO,EAAE,GAC1D,QAAQ,EAAE,CAUZ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function auditCommander(program) {
|
|
2
|
+
const rows = [];
|
|
3
|
+
function visit(command, path) {
|
|
4
|
+
const words = [...path, command.name()];
|
|
5
|
+
if (typeof Reflect.get(command, '_actionHandler') === 'function') {
|
|
6
|
+
const options = command.options.map((option) => option.long);
|
|
7
|
+
let help = '';
|
|
8
|
+
const output = { ...command.configureOutput() };
|
|
9
|
+
command.configureOutput({
|
|
10
|
+
writeOut: (text) => {
|
|
11
|
+
help += text;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
command.outputHelp();
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
command.configureOutput(output);
|
|
19
|
+
}
|
|
20
|
+
rows.push({
|
|
21
|
+
command: words.join(' '),
|
|
22
|
+
json: options.includes('--json'),
|
|
23
|
+
dryRun: options.includes('--dry-run'),
|
|
24
|
+
nonInteractiveFlag: options.includes('--no-interactive') ||
|
|
25
|
+
options.includes('--non-interactive') ||
|
|
26
|
+
options.includes('--yes'),
|
|
27
|
+
examples: /^\s*examples:\s*$/imu.test(help),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
for (const child of command.commands)
|
|
31
|
+
visit(child, words);
|
|
32
|
+
}
|
|
33
|
+
for (const command of program.commands)
|
|
34
|
+
visit(command, []);
|
|
35
|
+
return rows;
|
|
36
|
+
}
|
|
37
|
+
// JSON is an engine-wide option; cloud help currently has no examples. These are not per-command behavioral checks.
|
|
38
|
+
export function auditCloud(commands) {
|
|
39
|
+
return commands.map((command) => ({
|
|
40
|
+
command: command.path.join(' '),
|
|
41
|
+
json: true,
|
|
42
|
+
dryRun: 'dry-run' in (command.options ?? {}),
|
|
43
|
+
nonInteractiveFlag: 'yes' in (command.options ?? {}),
|
|
44
|
+
examples: false,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
export function auditProgram(program, commands) {
|
|
48
|
+
const cloud = auditCloud(commands);
|
|
49
|
+
const cloudNames = cloud.map((row) => row.command);
|
|
50
|
+
const local = auditCommander(program).filter((row) => !cloudNames.some((name) => name === row.command || name.startsWith(`${row.command} `)));
|
|
51
|
+
return [...local, ...cloud].sort((a, b) => a.command < b.command ? -1 : a.command > b.command ? 1 : 0);
|
|
52
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type { BillingCheckoutSessionResponse } from './api-client.js';
|
|
2
1
|
export declare function buildDextoBillingUrl(options: {
|
|
3
2
|
creditsUsd?: number | undefined;
|
|
4
3
|
baseUrl?: string | undefined;
|
|
5
4
|
}): string;
|
|
6
|
-
export declare function getBillingBalanceForCurrentLogin(): Promise<number | null>;
|
|
7
|
-
export declare function createBillingCheckoutForCurrentLogin(options: {
|
|
8
|
-
creditsUsd: number;
|
|
9
|
-
returnUrl?: string | undefined;
|
|
10
|
-
}): Promise<BillingCheckoutSessionResponse>;
|
|
11
5
|
export declare function openDextoBillingPage(options: {
|
|
12
6
|
url?: string | undefined;
|
|
13
7
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/billing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/billing.ts"],"names":[],"mappings":"AAGA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC1C,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,GAAG,MAAM,CAQT;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/F"}
|
package/dist/cli/auth/billing.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { getDextoApiClient } from './api-client.js';
|
|
2
1
|
import { openBrowserUrl } from './browser-launch.js';
|
|
3
2
|
import { DEXTO_CREDITS_URL } from './constants.js';
|
|
4
|
-
import { getAuthTokenQuietly } from './service.js';
|
|
5
|
-
function notLoggedInError() {
|
|
6
|
-
return new Error('Not logged in to Dexto');
|
|
7
|
-
}
|
|
8
3
|
export function buildDextoBillingUrl(options) {
|
|
9
4
|
const url = new URL(options.baseUrl ?? DEXTO_CREDITS_URL);
|
|
10
5
|
if (typeof options.creditsUsd === 'number' && Number.isFinite(options.creditsUsd)) {
|
|
@@ -12,24 +7,6 @@ export function buildDextoBillingUrl(options) {
|
|
|
12
7
|
}
|
|
13
8
|
return url.toString();
|
|
14
9
|
}
|
|
15
|
-
export async function getBillingBalanceForCurrentLogin() {
|
|
16
|
-
const authToken = await getAuthTokenQuietly();
|
|
17
|
-
if (!authToken) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const response = await getDextoApiClient().getBillingBalance(authToken, {});
|
|
21
|
-
return response.creditsUsd;
|
|
22
|
-
}
|
|
23
|
-
export async function createBillingCheckoutForCurrentLogin(options) {
|
|
24
|
-
const authToken = await getAuthTokenQuietly();
|
|
25
|
-
if (!authToken) {
|
|
26
|
-
throw notLoggedInError();
|
|
27
|
-
}
|
|
28
|
-
return getDextoApiClient().createBillingCheckoutSession(authToken, {
|
|
29
|
-
...options,
|
|
30
|
-
returnUrl: options.returnUrl ?? DEXTO_CREDITS_URL,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
10
|
export async function openDextoBillingPage(options) {
|
|
34
11
|
await openBrowserUrl(options.url ?? DEXTO_CREDITS_URL);
|
|
35
12
|
}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dexto's Supabase configuration for CLI authentication.
|
|
3
|
-
*
|
|
4
|
-
* SECURITY NOTE:
|
|
5
|
-
* The Supabase anon key is safe to hardcode in distributed code because:
|
|
6
|
-
* 1. It's designed for client-side use (web browsers, mobile apps, CLIs)
|
|
7
|
-
* 2. It only grants anonymous access - real security is enforced by Row Level Security (RLS)
|
|
8
|
-
* 3. This is standard practice (Vercel CLI, Supabase CLI, Firebase CLI all do the same)
|
|
9
|
-
*
|
|
10
|
-
* The service role key (which has admin access) is NEVER in this codebase.
|
|
11
|
-
*
|
|
12
|
-
* Environment variable overrides (for local development):
|
|
13
|
-
* - SUPABASE_URL: Override Supabase URL (e.g., http://localhost:54321)
|
|
14
|
-
* - SUPABASE_ANON_KEY: Override anon key (from `supabase start` output)
|
|
15
|
-
* - DEXTO_API_URL: Override Dexto gateway URL for data-plane calls (e.g., http://localhost:3001)
|
|
16
|
-
* - DEXTO_PLATFORM_URL: Override Dexto app URL for auth/key/account control-plane calls (e.g., http://localhost:3002)
|
|
17
|
-
* - DEXTO_PUBLIC_API_URL: Override versioned public API URL (e.g., http://localhost:3002)
|
|
18
|
-
*/
|
|
19
|
-
export declare const SUPABASE_URL: string;
|
|
20
|
-
export declare const SUPABASE_ANON_KEY: string;
|
|
21
|
-
/**
|
|
22
|
-
* Dexto gateway URL for retained data-plane endpoints.
|
|
23
|
-
*/
|
|
24
|
-
export declare const DEXTO_API_URL: string;
|
|
25
|
-
/**
|
|
26
|
-
* Dexto app URL for auth/key/account control-plane endpoints.
|
|
27
|
-
*/
|
|
28
|
-
export declare const DEFAULT_DEXTO_PLATFORM_URL = "https://app.dexto.ai";
|
|
1
|
+
/** The Dexto app a new sign-in goes to. */
|
|
29
2
|
export declare const DEXTO_PLATFORM_URL: string;
|
|
3
|
+
/** The versioned public API (`/v1`). */
|
|
30
4
|
export declare const DEXTO_PUBLIC_API_URL: string;
|
|
31
|
-
/**
|
|
32
|
-
* Dexto Nova credits purchase URL
|
|
33
|
-
*/
|
|
5
|
+
/** Where to buy Dexto credits. */
|
|
34
6
|
export declare const DEXTO_CREDITS_URL: string;
|
|
35
7
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/constants.ts"],"names":[],"mappings":"AAOA,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,QAA2D,CAAC;AAE3F,wCAAwC;AACxC,eAAO,MAAM,oBAAoB,QAA6D,CAAC;AAE/F,kCAAkC;AAClC,eAAO,MAAM,iBAAiB,QACwD,CAAC"}
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
// packages/cli/src/cli/auth/constants.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* The service role key (which has admin access) is NEVER in this codebase.
|
|
12
|
-
*
|
|
13
|
-
* Environment variable overrides (for local development):
|
|
14
|
-
* - SUPABASE_URL: Override Supabase URL (e.g., http://localhost:54321)
|
|
15
|
-
* - SUPABASE_ANON_KEY: Override anon key (from `supabase start` output)
|
|
16
|
-
* - DEXTO_API_URL: Override Dexto gateway URL for data-plane calls (e.g., http://localhost:3001)
|
|
17
|
-
* - DEXTO_PLATFORM_URL: Override Dexto app URL for auth/key/account control-plane calls (e.g., http://localhost:3002)
|
|
18
|
-
* - DEXTO_PUBLIC_API_URL: Override versioned public API URL (e.g., http://localhost:3002)
|
|
19
|
-
*/
|
|
20
|
-
export const SUPABASE_URL = process.env.SUPABASE_URL || 'https://gdfbxznhnnsamvsrtwjq.supabase.co';
|
|
21
|
-
export const SUPABASE_ANON_KEY = process.env.SUPABASE_ANON_KEY ||
|
|
22
|
-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImdkZmJ4em5obm5zYW12c3J0d2pxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQwNjkzNjksImV4cCI6MjA3OTY0NTM2OX0.j2NWOJDOy8gTT84XeomalkGSPpLdPvTCBnQMrTgdlI4';
|
|
23
|
-
/**
|
|
24
|
-
* Dexto gateway URL for retained data-plane endpoints.
|
|
25
|
-
*/
|
|
26
|
-
export const DEXTO_API_URL = process.env.DEXTO_API_URL || 'https://app.dexto.ai';
|
|
27
|
-
/**
|
|
28
|
-
* Dexto app URL for auth/key/account control-plane endpoints.
|
|
29
|
-
*/
|
|
30
|
-
export const DEFAULT_DEXTO_PLATFORM_URL = 'https://app.dexto.ai';
|
|
31
|
-
export const DEXTO_PLATFORM_URL = process.env.DEXTO_PLATFORM_URL || DEFAULT_DEXTO_PLATFORM_URL;
|
|
2
|
+
//
|
|
3
|
+
// Where the CLI reaches Dexto. Environment overrides, for previews and local development:
|
|
4
|
+
// - DEXTO_PLATFORM_URL: the Dexto app, home of its OAuth server and MCP (e.g. http://localhost:3002)
|
|
5
|
+
// - DEXTO_PUBLIC_API_URL: the versioned public API (e.g. http://localhost:3002)
|
|
6
|
+
// - DEXTO_CREDITS_URL: the page to buy credits on
|
|
7
|
+
/** The Dexto app a new sign-in goes to. */
|
|
8
|
+
export const DEXTO_PLATFORM_URL = process.env.DEXTO_PLATFORM_URL || 'https://app.dexto.ai';
|
|
9
|
+
/** The versioned public API (`/v1`). */
|
|
32
10
|
export const DEXTO_PUBLIC_API_URL = process.env.DEXTO_PUBLIC_API_URL || 'https://api.dexto.ai';
|
|
33
|
-
/**
|
|
34
|
-
* Dexto Nova credits purchase URL
|
|
35
|
-
*/
|
|
11
|
+
/** Where to buy Dexto credits. */
|
|
36
12
|
export const DEXTO_CREDITS_URL = process.env.DEXTO_CREDITS_URL || 'https://app.dexto.ai/dashboard/settings/billing';
|
package/dist/cli/auth/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { type DeviceApiKeyLoginResult } from './types.js';
|
|
4
|
-
export { type DeviceLoginPrompt, performDeviceCodeLogin } from './device.js';
|
|
5
|
-
export { type PersistOAuthLoginOptions, type PersistedLoginResult, persistDeviceApiKeyLoginResult, persistOAuthLoginResult, } from './login-persistence.js';
|
|
6
|
-
export { type UsageSummaryResponse, DextoApiClient, getDextoApiClient } from './api-client.js';
|
|
7
|
-
export { SUPABASE_URL, SUPABASE_ANON_KEY, DEXTO_API_URL, DEXTO_PLATFORM_URL, DEXTO_PUBLIC_API_URL, } from './constants.js';
|
|
8
|
-
export { buildDextoBillingUrl, getBillingBalanceForCurrentLogin, createBillingCheckoutForCurrentLogin, openDextoBillingPage, } from './billing.js';
|
|
9
|
-
export { type DextoApiKeyProvisionStatus, type DextoApiKeyProvisionStatusLevel, type EnsureDextoApiKeyOptions, ensureDextoApiKeyForAuthToken, saveDextoApiKeyToEnv, removeDextoApiKeyFromEnv, } from './dexto-api-key.js';
|
|
1
|
+
export { DEXTO_PLATFORM_URL, DEXTO_PUBLIC_API_URL } from './constants.js';
|
|
2
|
+
export { buildDextoBillingUrl, openDextoBillingPage } from './billing.js';
|
|
10
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/index.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/cli/auth/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
// packages/cli/src/cli/auth/index.ts
|
|
2
2
|
// Public exports for auth module
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { persistDeviceApiKeyLoginResult, persistOAuthLoginResult, } from './login-persistence.js';
|
|
6
|
-
export { DextoApiClient, getDextoApiClient } from './api-client.js';
|
|
7
|
-
export { SUPABASE_URL, SUPABASE_ANON_KEY, DEXTO_API_URL, DEXTO_PLATFORM_URL, DEXTO_PUBLIC_API_URL, } from './constants.js';
|
|
8
|
-
export { buildDextoBillingUrl, getBillingBalanceForCurrentLogin, createBillingCheckoutForCurrentLogin, openDextoBillingPage, } from './billing.js';
|
|
9
|
-
export { ensureDextoApiKeyForAuthToken, saveDextoApiKeyToEnv, removeDextoApiKeyFromEnv, } from './dexto-api-key.js';
|
|
3
|
+
export { DEXTO_PLATFORM_URL, DEXTO_PUBLIC_API_URL } from './constants.js';
|
|
4
|
+
export { buildDextoBillingUrl, openDextoBillingPage } from './billing.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { dextoSignIn } from '@dexto/agent-management';
|
|
2
|
+
type RedirectListener = dextoSignIn.RedirectListener;
|
|
3
|
+
type SignInRuntime = dextoSignIn.SignInRuntime;
|
|
4
|
+
/**
|
|
5
|
+
* Listens on 127.0.0.1 at any free port for the browser's redirect to `/callback` (RFC 8252), and
|
|
6
|
+
* resolves with its query on the first one.
|
|
7
|
+
*/
|
|
8
|
+
export declare function listenForRedirect(): Promise<RedirectListener>;
|
|
9
|
+
/** Signing in from this process: notes go to stderr so stdout stays for results. */
|
|
10
|
+
export declare function nodeSignInRuntime(signal: AbortSignal): SignInRuntime;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=sign-in-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in-runtime.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/sign-in-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,KAAK,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;AACrD,KAAK,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;AAM/C;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA6BnE;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAepE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The Node side of signing in: a loopback redirect listener, the browser and timers.
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { setTimeout as sleep } from 'node:timers/promises';
|
|
4
|
+
import { openBrowserUrl } from './browser-launch.js';
|
|
5
|
+
const DONE_PAGE = `<!doctype html><meta charset="utf-8"><title>Dexto</title>
|
|
6
|
+
<body style="font-family:system-ui;margin:4rem auto;max-width:28rem">
|
|
7
|
+
<h1>Signed in</h1><p>You can close this tab and return to your terminal.</p></body>`;
|
|
8
|
+
/**
|
|
9
|
+
* Listens on 127.0.0.1 at any free port for the browser's redirect to `/callback` (RFC 8252), and
|
|
10
|
+
* resolves with its query on the first one.
|
|
11
|
+
*/
|
|
12
|
+
export async function listenForRedirect() {
|
|
13
|
+
let deliver = () => undefined;
|
|
14
|
+
const result = new Promise((resolve) => {
|
|
15
|
+
deliver = resolve;
|
|
16
|
+
});
|
|
17
|
+
const server = createServer((request, response) => {
|
|
18
|
+
const url = new URL(request.url ?? '/', 'http://127.0.0.1');
|
|
19
|
+
if (request.method !== 'GET' || url.pathname !== '/callback') {
|
|
20
|
+
response.writeHead(404).end();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
response.writeHead(200, { 'content-type': 'text/html; charset=utf-8' }).end(DONE_PAGE);
|
|
24
|
+
deliver(url.searchParams);
|
|
25
|
+
});
|
|
26
|
+
await new Promise((resolve, reject) => {
|
|
27
|
+
server.once('error', reject);
|
|
28
|
+
server.listen(0, '127.0.0.1', () => resolve());
|
|
29
|
+
});
|
|
30
|
+
const address = server.address();
|
|
31
|
+
if (address === null || typeof address === 'string')
|
|
32
|
+
throw new Error('The sign-in listener has no port.');
|
|
33
|
+
return {
|
|
34
|
+
redirectUri: `http://127.0.0.1:${address.port}/callback`,
|
|
35
|
+
result,
|
|
36
|
+
close: () => {
|
|
37
|
+
server.closeAllConnections();
|
|
38
|
+
server.close();
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Signing in from this process: notes go to stderr so stdout stays for results. */
|
|
43
|
+
export function nodeSignInRuntime(signal) {
|
|
44
|
+
return {
|
|
45
|
+
fetch: globalThis.fetch,
|
|
46
|
+
signal,
|
|
47
|
+
note: (text) => process.stderr.write(`${text}\n`),
|
|
48
|
+
openBrowser: async (url) => {
|
|
49
|
+
try {
|
|
50
|
+
await openBrowserUrl(url);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// The URL was already printed; the person opens it by hand.
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
listenForRedirect,
|
|
57
|
+
sleep: (ms) => sleep(ms, undefined, { signal }),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CloudRuntime } from './runtime.js';
|
|
2
|
+
/** Each app's operations by tool or action name, with their scopes; empty from an older server. */
|
|
3
|
+
export declare function readAppScopes(runtime: CloudRuntime, appUrl: string): Promise<ReadonlyMap<string, Readonly<Record<string, readonly string[]>>>>;
|
|
4
|
+
//# sourceMappingURL=app-scopes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-scopes.d.ts","sourceRoot":"","sources":["../../../src/cli/cloud/app-scopes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,mGAAmG;AACnG,wBAAsB,aAAa,CAC/B,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAS3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Each workspace app's operations and the scopes each takes, from the MCP's published metadata,
|
|
2
|
+
// so a command can sign in for an operation the sign-in can't see yet.
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
const ProtectedResourceSchema = z.object({
|
|
5
|
+
/** Every scope each app's operations take; an older server publishes none. */
|
|
6
|
+
dexto_app_scopes: z.record(z.string(), z.record(z.string(), z.array(z.string()))).optional(),
|
|
7
|
+
});
|
|
8
|
+
/** Each app's operations by tool or action name, with their scopes; empty from an older server. */
|
|
9
|
+
export async function readAppScopes(runtime, appUrl) {
|
|
10
|
+
const url = `${appUrl.replace(/\/+$/u, '')}/.well-known/oauth-protected-resource/mcp`;
|
|
11
|
+
const response = await runtime.fetch(url, {
|
|
12
|
+
headers: { accept: 'application/json' },
|
|
13
|
+
signal: runtime.signal,
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok)
|
|
16
|
+
throw new Error(`${url} answered HTTP ${response.status}.`);
|
|
17
|
+
const metadata = ProtectedResourceSchema.parse(await response.json());
|
|
18
|
+
return new Map(Object.entries(metadata.dexto_app_scopes ?? {}));
|
|
19
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { CloudClient } from '@dexto/cloud-client';
|
|
2
|
+
import { CommandFailure } from '../failure.js';
|
|
3
|
+
import type { Connection, ConnectionOverrides } from './connection.js';
|
|
4
|
+
import type { Output } from './output.js';
|
|
5
|
+
import type { CloudRuntime } from './runtime.js';
|
|
6
|
+
export interface OptionSpec {
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly multiple?: true;
|
|
9
|
+
readonly short?: string;
|
|
10
|
+
readonly type: 'boolean' | 'string';
|
|
11
|
+
/** The value's name in help, such as ID; string options only. */
|
|
12
|
+
readonly valueName?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Command {
|
|
15
|
+
/** Such as `<agent_id> [message...]`; `<x>` is required, `[x]` optional. */
|
|
16
|
+
readonly arguments?: string;
|
|
17
|
+
readonly options?: Readonly<Record<string, OptionSpec>>;
|
|
18
|
+
/** The words that select it, such as ["agents", "sessions", "list"]. */
|
|
19
|
+
readonly path: readonly string[];
|
|
20
|
+
readonly summary: string;
|
|
21
|
+
run(context: CommandContext, input: CommandInput): Promise<number | void>;
|
|
22
|
+
}
|
|
23
|
+
export interface CommandInput {
|
|
24
|
+
readonly positionals: readonly string[];
|
|
25
|
+
readonly values: Readonly<Record<string, string | boolean | (string | boolean)[] | undefined>>;
|
|
26
|
+
}
|
|
27
|
+
export interface CommandContext {
|
|
28
|
+
/** The /v1 client for the resolved credential; fails with how to sign in when there is none. */
|
|
29
|
+
client(): Promise<CloudClient>;
|
|
30
|
+
connection(): Promise<Connection>;
|
|
31
|
+
/** The words the command was run with, its connection options included and any key left out. */
|
|
32
|
+
readonly invocation: readonly string[];
|
|
33
|
+
readonly output: Output;
|
|
34
|
+
readonly overrides: ConnectionOverrides;
|
|
35
|
+
readonly runtime: CloudRuntime;
|
|
36
|
+
}
|
|
37
|
+
/** A mistake in how the command was called: printed with the command's usage. */
|
|
38
|
+
export declare class UsageError extends Error {
|
|
39
|
+
constructor(message: string);
|
|
40
|
+
}
|
|
41
|
+
/** A permission the sign-in lacks: signing in again for `scope` (one, or several comma-separated) fixes it. */
|
|
42
|
+
export declare class MissingScopeFailure extends CommandFailure {
|
|
43
|
+
readonly scope: string;
|
|
44
|
+
constructor(context: SignInContext, scope: string, message: string);
|
|
45
|
+
}
|
|
46
|
+
export declare function stringOption(input: CommandInput, name: string): string | undefined;
|
|
47
|
+
export declare function requiredOption(input: CommandInput, name: string): string;
|
|
48
|
+
export declare function listOption(input: CommandInput, name: string): string[];
|
|
49
|
+
export declare function flag(input: CommandInput, name: string): boolean;
|
|
50
|
+
export declare function integerOption(input: CommandInput, name: string): number | undefined;
|
|
51
|
+
/** A string option that must be one of `values`, checked before anything is sent. */
|
|
52
|
+
export declare function choiceOption<const T extends string>(input: CommandInput, name: string, values: readonly T[]): T | undefined;
|
|
53
|
+
export declare function argument(input: CommandInput, index: number, name: string): string;
|
|
54
|
+
/** `--limit` and `--after`, which every list takes. */
|
|
55
|
+
export declare const PAGE_OPTIONS: {
|
|
56
|
+
readonly after: {
|
|
57
|
+
readonly description: "Start after this cursor, from the previous page.";
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly valueName: "CURSOR";
|
|
60
|
+
};
|
|
61
|
+
readonly limit: {
|
|
62
|
+
readonly description: "How many to return.";
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly valueName: "N";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export declare function pageQuery(input: CommandInput): {
|
|
68
|
+
after?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
};
|
|
71
|
+
/** `--data <json>` and `--file <path|->`, for request bodies too rich for flags. */
|
|
72
|
+
export declare const BODY_OPTIONS: {
|
|
73
|
+
readonly data: {
|
|
74
|
+
readonly description: "The request body as JSON.";
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly valueName: "JSON";
|
|
77
|
+
};
|
|
78
|
+
readonly file: {
|
|
79
|
+
readonly description: "Read the request body from a JSON file, or - for stdin.";
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly valueName: "PATH";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/** The JSON body from --data or --file; null when neither was given. */
|
|
85
|
+
export declare function readJsonBody(context: CommandContext, input: CommandInput): Promise<unknown>;
|
|
86
|
+
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
87
|
+
/** A value the person types, hidden when secret, or piped on stdin. */
|
|
88
|
+
export declare function readValue(context: CommandContext, question: string, secret: boolean): Promise<string>;
|
|
89
|
+
export declare const YES_OPTION: {
|
|
90
|
+
readonly yes: {
|
|
91
|
+
readonly description: "Go ahead without being asked. Pass it only once your person has agreed.";
|
|
92
|
+
readonly type: "boolean";
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Whether a sign-in here should use a device code: no one is at this terminal, or it is an SSH
|
|
97
|
+
* session, whose loopback redirect a browser on the person's own device can't reach.
|
|
98
|
+
*/
|
|
99
|
+
export declare function signsInWithDevice(runtime: CloudRuntime): boolean;
|
|
100
|
+
/** What saying how to sign in again needs: the process, and the profile `--profile` chose. */
|
|
101
|
+
export type SignInContext = Pick<CommandContext, 'overrides' | 'runtime'>;
|
|
102
|
+
/**
|
|
103
|
+
* How to sign in again, to the same app and profile, with a device code where a browser can't
|
|
104
|
+
* finish it.
|
|
105
|
+
*/
|
|
106
|
+
export declare function signInCommand(context: SignInContext, scope: string | null): string;
|
|
107
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/cli/cloud/command.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// The shape every cloud command shares: its path, arguments, options and handler.
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { CommandFailure } from '../failure.js';
|
|
4
|
+
import { shellWord } from '../interaction.js';
|
|
5
|
+
/** A mistake in how the command was called: printed with the command's usage. */
|
|
6
|
+
export class UsageError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'UsageError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** A permission the sign-in lacks: signing in again for `scope` (one, or several comma-separated) fixes it. */
|
|
13
|
+
export class MissingScopeFailure extends CommandFailure {
|
|
14
|
+
scope;
|
|
15
|
+
constructor(context, scope, message) {
|
|
16
|
+
super('needs_permission', message, signInCommand(context, scope));
|
|
17
|
+
this.name = 'MissingScopeFailure';
|
|
18
|
+
this.scope = scope;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function stringOption(input, name) {
|
|
22
|
+
const value = input.values[name];
|
|
23
|
+
return typeof value === 'string' ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
export function requiredOption(input, name) {
|
|
26
|
+
const value = stringOption(input, name);
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
throw new UsageError(`--${name} is required.`);
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
export function listOption(input, name) {
|
|
32
|
+
const value = input.values[name];
|
|
33
|
+
return Array.isArray(value)
|
|
34
|
+
? value.filter((item) => typeof item === 'string')
|
|
35
|
+
: [];
|
|
36
|
+
}
|
|
37
|
+
export function flag(input, name) {
|
|
38
|
+
return input.values[name] === true;
|
|
39
|
+
}
|
|
40
|
+
export function integerOption(input, name) {
|
|
41
|
+
const value = stringOption(input, name);
|
|
42
|
+
if (value === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
const parsed = Number(value);
|
|
45
|
+
if (!Number.isInteger(parsed))
|
|
46
|
+
throw new UsageError(`--${name} must be a whole number.`);
|
|
47
|
+
return parsed;
|
|
48
|
+
}
|
|
49
|
+
/** A string option that must be one of `values`, checked before anything is sent. */
|
|
50
|
+
export function choiceOption(input, name, values) {
|
|
51
|
+
const value = stringOption(input, name);
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
const found = values.find((each) => each === value);
|
|
55
|
+
if (found === undefined)
|
|
56
|
+
throw new UsageError(`--${name} must be one of: ${values.join(', ')}.`);
|
|
57
|
+
return found;
|
|
58
|
+
}
|
|
59
|
+
export function argument(input, index, name) {
|
|
60
|
+
const value = input.positionals[index];
|
|
61
|
+
if (value === undefined)
|
|
62
|
+
throw new UsageError(`Missing ${name}.`);
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
/** `--limit` and `--after`, which every list takes. */
|
|
66
|
+
export const PAGE_OPTIONS = {
|
|
67
|
+
after: {
|
|
68
|
+
description: 'Start after this cursor, from the previous page.',
|
|
69
|
+
type: 'string',
|
|
70
|
+
valueName: 'CURSOR',
|
|
71
|
+
},
|
|
72
|
+
limit: { description: 'How many to return.', type: 'string', valueName: 'N' },
|
|
73
|
+
};
|
|
74
|
+
export function pageQuery(input) {
|
|
75
|
+
const after = stringOption(input, 'after');
|
|
76
|
+
const limit = integerOption(input, 'limit');
|
|
77
|
+
return {
|
|
78
|
+
...(after === undefined ? {} : { after }),
|
|
79
|
+
...(limit === undefined ? {} : { limit }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** `--data <json>` and `--file <path|->`, for request bodies too rich for flags. */
|
|
83
|
+
export const BODY_OPTIONS = {
|
|
84
|
+
data: { description: 'The request body as JSON.', type: 'string', valueName: 'JSON' },
|
|
85
|
+
file: {
|
|
86
|
+
description: 'Read the request body from a JSON file, or - for stdin.',
|
|
87
|
+
type: 'string',
|
|
88
|
+
valueName: 'PATH',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/** The JSON body from --data or --file; null when neither was given. */
|
|
92
|
+
export async function readJsonBody(context, input) {
|
|
93
|
+
const data = stringOption(input, 'data');
|
|
94
|
+
const file = stringOption(input, 'file');
|
|
95
|
+
if (data !== undefined && file !== undefined)
|
|
96
|
+
throw new UsageError('Pass --data or --file, not both.');
|
|
97
|
+
const text = data ??
|
|
98
|
+
(file === undefined
|
|
99
|
+
? null
|
|
100
|
+
: file === '-'
|
|
101
|
+
? await context.runtime.readStdin()
|
|
102
|
+
: await readFile(file, 'utf8'));
|
|
103
|
+
if (text === null)
|
|
104
|
+
return null;
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(text);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new UsageError(`The request body is not valid JSON${file ? ` (${file})` : ''}.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export function isJsonObject(value) {
|
|
113
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
114
|
+
}
|
|
115
|
+
/** A value the person types, hidden when secret, or piped on stdin. */
|
|
116
|
+
export async function readValue(context, question, secret) {
|
|
117
|
+
const value = context.runtime.prompt === null
|
|
118
|
+
? (await context.runtime.readStdin()).replace(/\r?\n$/u, '')
|
|
119
|
+
: await context.runtime.prompt(question, { secret });
|
|
120
|
+
if (value.length === 0)
|
|
121
|
+
throw new UsageError('No value was given.');
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
export const YES_OPTION = {
|
|
125
|
+
yes: {
|
|
126
|
+
description: 'Go ahead without being asked. Pass it only once your person has agreed.',
|
|
127
|
+
type: 'boolean',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Whether a sign-in here should use a device code: no one is at this terminal, or it is an SSH
|
|
132
|
+
* session, whose loopback redirect a browser on the person's own device can't reach.
|
|
133
|
+
*/
|
|
134
|
+
export function signsInWithDevice(runtime) {
|
|
135
|
+
return (runtime.prompt === null ||
|
|
136
|
+
runtime.environment.SSH_CONNECTION !== undefined ||
|
|
137
|
+
runtime.environment.SSH_TTY !== undefined);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* How to sign in again, to the same app and profile, with a device code where a browser can't
|
|
141
|
+
* finish it.
|
|
142
|
+
*/
|
|
143
|
+
export function signInCommand(context, scope) {
|
|
144
|
+
const profile = context.overrides.profile;
|
|
145
|
+
return [
|
|
146
|
+
'dexto',
|
|
147
|
+
'login',
|
|
148
|
+
...(profile === null ? [] : ['--profile', profile]),
|
|
149
|
+
...(signsInWithDevice(context.runtime) ? ['--device'] : []),
|
|
150
|
+
...(scope === null ? [] : ['--scope', scope]),
|
|
151
|
+
]
|
|
152
|
+
.map(shellWord)
|
|
153
|
+
.join(' ');
|
|
154
|
+
}
|