dexto 1.14.4 → 2.0.0-beta.0
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/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 +143 -0
- package/dist/cli/cloud/command.d.ts.map +1 -0
- package/dist/cli/cloud/command.js +202 -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 +128 -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 +524 -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/automations.d.ts +3 -0
- package/dist/cli/cloud/commands/automations.d.ts.map +1 -0
- package/dist/cli/cloud/commands/automations.js +232 -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 +189 -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 +54 -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 +223 -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 +320 -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 +282 -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 +248 -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 +119 -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 +138 -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 +265 -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 +110 -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 +202 -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 +656 -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 +279 -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 +105 -0
- package/dist/cli/cloud/local-chats.d.ts +73 -0
- package/dist/cli/cloud/local-chats.d.ts.map +1 -0
- package/dist/cli/cloud/local-chats.js +441 -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 +76 -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 +35 -0
- package/dist/cli/cloud/v1.d.ts +19 -0
- package/dist/cli/cloud/v1.d.ts.map +1 -0
- package/dist/cli/cloud/v1.js +65 -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 +247 -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 +42 -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.js +2 -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/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/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/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/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 +33 -65
- package/package.json +8 -7
- 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
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
import { withAnalytics, safeExit } from '../../../analytics/wrapper.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/** The top-level words the cloud command engine owns, and what each is for. */
|
|
3
|
+
const ENGINE_WORDS = {
|
|
4
|
+
login: 'Sign in to Dexto with your browser or a device code, or save an API key for CI',
|
|
5
|
+
logout: 'End the sign-in on the server and forget it here',
|
|
6
|
+
whoami: 'Show who Dexto commands act as',
|
|
7
|
+
accounts: 'List, switch and remove saved sign-ins, one per account and organization',
|
|
8
|
+
models: 'Models Dexto serves on your sign-in',
|
|
9
|
+
billing: "Show the organization's credit balance and recent spending",
|
|
10
|
+
cloud: 'Build in Dexto Cloud: projects, agents, files, sandboxes and more',
|
|
11
|
+
workspace: 'Use your Dexto workspace as yourself: its apps and tools, over the Dexto MCP',
|
|
12
|
+
find: 'Find the command for something you want to do in Dexto',
|
|
13
|
+
publish: 'Publish a file, folder or .zip as a link anyone with it can open',
|
|
14
|
+
profile: 'Show and change your Dexto profile: handle, name, bio and who can see it',
|
|
15
|
+
skills: 'Push a local Skill folder into your Dexto Skills library',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* These words run on the cloud command engine, which reads its own arguments and global options
|
|
19
|
+
* (--json, --api-key, --profile, --project). Analytics records only the command name, never its
|
|
20
|
+
* arguments, which can hold a key.
|
|
21
|
+
*/
|
|
7
22
|
export function registerCloudCommand(program) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
for (const [word, description] of Object.entries(ENGINE_WORDS))
|
|
24
|
+
program
|
|
25
|
+
.command(word)
|
|
26
|
+
.description(description)
|
|
27
|
+
.helpOption(false)
|
|
28
|
+
.passThroughOptions()
|
|
29
|
+
.allowUnknownOption()
|
|
30
|
+
.allowExcessArguments()
|
|
31
|
+
.argument('[args...]')
|
|
32
|
+
.action(async (args) => {
|
|
33
|
+
await withAnalytics(word, async () => {
|
|
34
|
+
const [{ runCloud }, { nodeCloudHost }] = await Promise.all([
|
|
35
|
+
import('../../cloud/run.js'),
|
|
36
|
+
import('../../cloud/host.js'),
|
|
37
|
+
]);
|
|
38
|
+
const code = await runCloud(nodeCloudHost(new AbortController().signal), [
|
|
39
|
+
word,
|
|
40
|
+
...args,
|
|
41
|
+
]);
|
|
42
|
+
safeExit(word, code);
|
|
43
|
+
})();
|
|
44
|
+
});
|
|
27
45
|
}
|
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import * as p from '@clack/prompts';
|
|
5
5
|
import { selectOrExit } from '../utils/prompt-helpers.js';
|
|
6
|
-
import { promptForProjectName, createProjectDirectory, setupGitRepo, createGitignore, initPackageJson, createTsconfigForApp, installDependencies, createEnvExample, ensureDirectory,
|
|
6
|
+
import { promptForProjectName, createProjectDirectory, setupGitRepo, createGitignore, initPackageJson, createTsconfigForApp, installDependencies, createEnvExample, ensureDirectory, dextoPackageRange, } from '../utils/scaffolding-utils.js';
|
|
7
7
|
import { generateIndexForCodeFirstDI, generateWebServerIndexForCodeFirstDI, generateWebAppHTML, generateWebAppJS, generateWebAppCSS, generateAppReadme, } from '../utils/template-engine.js';
|
|
8
8
|
import { getExecutionContext } from '@dexto/agent-management';
|
|
9
9
|
/**
|
|
@@ -115,18 +115,17 @@ async function scaffoldCodeFirstDI(projectPath, projectName, appType, spinner) {
|
|
|
115
115
|
spinner.message('Installing dependencies...');
|
|
116
116
|
const executionContext = getExecutionContext();
|
|
117
117
|
const isDextoSource = executionContext === 'dexto-source';
|
|
118
|
-
const
|
|
119
|
-
const dextoDependencyVersion = isDextoSource ? 'workspace:*' : versionRange;
|
|
118
|
+
const dexto = (name) => `${name}@${isDextoSource ? 'workspace:*' : dextoPackageRange(name)}`;
|
|
120
119
|
const dependencies = [
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
dexto('@dexto/core'),
|
|
121
|
+
dexto('@dexto/storage'),
|
|
123
122
|
// Intentionally omit tool packs in the scaffold to keep the onboarding example minimal.
|
|
124
123
|
// TODO: Revisit adding a default tool pack once tool IDs no longer require manual qualification.
|
|
125
124
|
'dotenv',
|
|
126
125
|
'tsx',
|
|
127
126
|
];
|
|
128
127
|
if (appType === 'webapp') {
|
|
129
|
-
dependencies.push(
|
|
128
|
+
dependencies.push(dexto('@dexto/server'));
|
|
130
129
|
}
|
|
131
130
|
await installDependencies(projectPath, {
|
|
132
131
|
dependencies,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-image.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/create-image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-image.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/create-image.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuOhE"}
|
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import * as p from '@clack/prompts';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { selectOrExit, textOrExit } from '../utils/prompt-helpers.js';
|
|
5
|
-
import { promptForProjectName, createProjectDirectory, setupGitRepo, createGitignore, initPackageJson, createTsconfigForImage,
|
|
5
|
+
import { promptForProjectName, createProjectDirectory, setupGitRepo, createGitignore, initPackageJson, createTsconfigForImage, dextoPackageRange, dextoPeerRange, installDependencies, pinDextoPackageIfUnversioned, ensureDirectory, } from '../utils/scaffolding-utils.js';
|
|
6
6
|
import { generateDextoImageFile, generateImageReadme, generateExampleTool, generateExampleHook, generateExampleCompaction, } from '../utils/template-engine.js';
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
import { getExecutionContext } from '@dexto/agent-management';
|
|
@@ -133,23 +133,22 @@ export async function createImage(name) {
|
|
|
133
133
|
// Detect if we're in dexto source - use workspace protocol for local development
|
|
134
134
|
const executionContext = getExecutionContext();
|
|
135
135
|
const isDextoSource = executionContext === 'dexto-source';
|
|
136
|
-
const
|
|
137
|
-
const
|
|
136
|
+
const dextoRange = (name) => isDextoSource ? 'workspace:*' : dextoPackageRange(name);
|
|
137
|
+
const dexto = (name) => `${name}@${dextoRange(name)}`;
|
|
138
138
|
// Determine dependencies based on whether extending
|
|
139
139
|
const dependencies = [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
'zod
|
|
140
|
+
dexto('@dexto/core'),
|
|
141
|
+
dexto('@dexto/agent-config'),
|
|
142
|
+
dexto('@dexto/storage'),
|
|
143
|
+
`zod@${dextoPeerRange('zod')}`,
|
|
144
144
|
];
|
|
145
145
|
const devDependencies = [
|
|
146
146
|
'typescript@^5.0.0',
|
|
147
147
|
'@types/node@^20.0.0',
|
|
148
|
-
|
|
148
|
+
dexto('@dexto/image-bundler'),
|
|
149
149
|
];
|
|
150
150
|
if (baseImage) {
|
|
151
|
-
|
|
152
|
-
dependencies.push(baseImageDependency);
|
|
151
|
+
dependencies.push(pinDextoPackageIfUnversioned(baseImage, dextoRange));
|
|
153
152
|
}
|
|
154
153
|
// Install dependencies (use pnpm in dexto source for workspace protocol support)
|
|
155
154
|
await installDependencies(projectPath, {
|
|
@@ -12,7 +12,5 @@ export { handleListAgentsCommand, type ListAgentsCommandOptions, type ListAgents
|
|
|
12
12
|
export { handleWhichCommand, type WhichCommandOptions } from './which.js';
|
|
13
13
|
export { handleSyncAgentsCommand, shouldPromptForSync, type SyncAgentsCommandOptions, } from './agents/sync.js';
|
|
14
14
|
export { handleImageInstallCommand, handleImageListCommand, handleImageUseCommand, handleImageRemoveCommand, handleImageDoctorCommand, type ImageInstallCommandOptions, type ImageInstallCommandOptionsInput, } from './image.js';
|
|
15
|
-
export { handleLoginCommand, handleLogoutCommand, handleStatusCommand } from './auth/index.js';
|
|
16
|
-
export { handleBillingStatusCommand } from './billing/index.js';
|
|
17
15
|
export { handlePluginListCommand, handlePluginInstallCommand, handlePluginUninstallCommand, handlePluginValidateCommand, handleMarketplaceAddCommand, handleMarketplaceRemoveCommand, handleMarketplaceUpdateCommand, handleMarketplaceListCommand, handleMarketplacePluginsCommand, handleMarketplaceInstallCommand, type PluginListCommandOptions, type PluginListCommandOptionsInput, type PluginInstallCommandOptions, type PluginInstallCommandOptionsInput, type PluginUninstallCommandOptions, type PluginUninstallCommandOptionsInput, type PluginValidateCommandOptions, type PluginValidateCommandOptionsInput, type MarketplaceAddCommandOptionsInput, type MarketplaceRemoveCommandOptionsInput, type MarketplaceUpdateCommandOptionsInput, type MarketplaceListCommandOptionsInput, type MarketplaceInstallCommandOptionsInput, } from './plugin.js';
|
|
18
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,KAAK,0BAA0B,EAAE,MAAM,gBAAgB,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B,CAAC;AAC5F,OAAO,EACH,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,GACrC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,wBAAwB,GAChC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACH,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACvC,MAAM,YAAY,CAAC;AAOpB,OAAO,EACH,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAE3B,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,4BAA4B,EAC5B,+BAA+B,EAC/B,+BAA+B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EAEtC,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,GAC7C,MAAM,aAAa,CAAC"}
|
|
@@ -16,9 +16,7 @@ export { handleSyncAgentsCommand, shouldPromptForSync, } from './agents/sync.js'
|
|
|
16
16
|
// Image commands
|
|
17
17
|
export { handleImageInstallCommand, handleImageListCommand, handleImageUseCommand, handleImageRemoveCommand, handleImageDoctorCommand, } from './image.js';
|
|
18
18
|
// Auth commands
|
|
19
|
-
export { handleLoginCommand, handleLogoutCommand, handleStatusCommand } from './auth/index.js';
|
|
20
19
|
// Billing commands
|
|
21
|
-
export { handleBillingStatusCommand } from './billing/index.js';
|
|
22
20
|
// Plugin commands
|
|
23
21
|
export { handlePluginListCommand, handlePluginInstallCommand, handlePluginUninstallCommand, handlePluginValidateCommand,
|
|
24
22
|
// Marketplace handlers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CzC,KAAK,mBAAmB,GAAG,SAAS,GAAG,UAAU,CAAC;AAClD,KAAK,oBAAoB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAC1D,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,4BAA4B;IACzC,SAAS,EAAE,uBAAuB,CAAC;IACnC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,oBAAoB,CAAA;KAAE,CAAC;IACzD,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAC3D,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,WAAW,CAAA;KA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AAsB,GACtC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AA4ED,wBAAsB,iBAAiB,CAAC,aAAa,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB5F;AAED,wBAAsB,sBAAsB,CACxC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,GAAE,uBAA4B,EACrC,aAAa,GAAE,MAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CAuDf;AAED,wBAAsB,sBAAsB,CACxC,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,MAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,wBAAwB,CAC1C,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,aAAa,GAAE,MAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,uBAAuB,CACzC,aAAa,GAAE,MAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,0BAA0B,GAAG,IAAI,CAmGjF"}
|
|
@@ -8,8 +8,6 @@ import path from 'node:path';
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { ExitSignal, safeExit, withAnalytics } from '../../analytics/wrapper.js';
|
|
10
10
|
import { getEffectiveLLMConfig } from '../../config/effective-llm.js';
|
|
11
|
-
import { getDeployConfigPath, isWorkspaceDeployAgent, loadDeployConfig } from './deploy/config.js';
|
|
12
|
-
import { discoverPrimaryWorkspaceAgent } from './deploy/entry-agent.js';
|
|
13
11
|
import { confirmOrExit, multiselectOrExit, selectOrExit, textOrExit, } from '../utils/prompt-helpers.js';
|
|
14
12
|
import { ensureImageImporterConfigured } from '../utils/image-importer.js';
|
|
15
13
|
const AGENTS_FILENAME = 'AGENTS.md';
|
|
@@ -34,7 +32,7 @@ This workspace can define project-specific agents and skills.
|
|
|
34
32
|
|
|
35
33
|
## Defaults
|
|
36
34
|
- If no workspace agent is defined, Dexto uses your global default agent locally
|
|
37
|
-
-
|
|
35
|
+
- Deploy Sites and Functions with \`dexto cloud sites deploy\` and \`dexto cloud functions deploy\`
|
|
38
36
|
`;
|
|
39
37
|
const CORE_AGENT_TOOL_ENTRIES = [
|
|
40
38
|
{
|
|
@@ -1335,18 +1333,8 @@ async function listWorkspaceSkillIds(workspaceRoot) {
|
|
|
1335
1333
|
.map((skill) => skill.name)
|
|
1336
1334
|
.sort((left, right) => left.localeCompare(right));
|
|
1337
1335
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
const configuredAgent = isWorkspaceDeployAgent(input.deployConfig.agent)
|
|
1341
|
-
? `workspace agent (${input.deployConfig.agent.path})`
|
|
1342
|
-
: 'default cloud agent';
|
|
1343
|
-
return `${configuredAgent} via ${input.deployConfigPath ?? '.dexto/deploy.json'}`;
|
|
1344
|
-
}
|
|
1345
|
-
if (input.implicitWorkspaceAgent) {
|
|
1346
|
-
return `workspace agent (${input.implicitWorkspaceAgent}) if you run \`dexto deploy\``;
|
|
1347
|
-
}
|
|
1348
|
-
return 'default cloud agent if you run `dexto deploy`';
|
|
1349
|
-
}
|
|
1336
|
+
/** Where deploys went: 1.x's workspace deploy is gone in 2.0. */
|
|
1337
|
+
const DEPLOY_SUMMARY = 'dexto cloud sites deploy or dexto cloud functions deploy (dexto deploy is gone in 2.0)';
|
|
1350
1338
|
export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
|
|
1351
1339
|
const root = path.resolve(workspaceRoot);
|
|
1352
1340
|
await ensureWorkspaceRoot(root);
|
|
@@ -1365,9 +1353,6 @@ export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
|
|
|
1365
1353
|
}))
|
|
1366
1354
|
.sort((left, right) => left.id.localeCompare(right.id)) ?? [];
|
|
1367
1355
|
const skills = await listWorkspaceSkillIds(root);
|
|
1368
|
-
const deployConfigPath = getDeployConfigPath(root);
|
|
1369
|
-
const deployConfig = await loadDeployConfig(root);
|
|
1370
|
-
const implicitWorkspaceAgent = await discoverPrimaryWorkspaceAgent(root);
|
|
1371
1356
|
return {
|
|
1372
1357
|
workspaceRoot: root,
|
|
1373
1358
|
agentsFilePresent,
|
|
@@ -1378,12 +1363,6 @@ export async function inspectWorkspaceStatus(workspaceRoot = process.cwd()) {
|
|
|
1378
1363
|
allowGlobalAgents: registry ? registry.allowGlobalAgents : null,
|
|
1379
1364
|
agents,
|
|
1380
1365
|
skills,
|
|
1381
|
-
deployConfigPath: deployConfig ? deployConfigPath : null,
|
|
1382
|
-
effectiveDeploySummary: describeEffectiveDeployAgent({
|
|
1383
|
-
deployConfigPath: deployConfig ? deployConfigPath : null,
|
|
1384
|
-
deployConfig,
|
|
1385
|
-
implicitWorkspaceAgent,
|
|
1386
|
-
}),
|
|
1387
1366
|
};
|
|
1388
1367
|
}
|
|
1389
1368
|
function formatWorkspaceStatus(result) {
|
|
@@ -1397,7 +1376,7 @@ function formatWorkspaceStatus(result) {
|
|
|
1397
1376
|
`Allow global agents: ${result.allowGlobalAgents === null
|
|
1398
1377
|
? 'n/a (no workspace registry)'
|
|
1399
1378
|
: String(result.allowGlobalAgents)}`,
|
|
1400
|
-
`Deploy: ${
|
|
1379
|
+
`Deploy: ${DEPLOY_SUMMARY}`,
|
|
1401
1380
|
'',
|
|
1402
1381
|
'Agents:',
|
|
1403
1382
|
...(result.agents.length > 0
|
|
@@ -1601,7 +1580,7 @@ Examples:
|
|
|
1601
1580
|
}));
|
|
1602
1581
|
initCommand
|
|
1603
1582
|
.command('status')
|
|
1604
|
-
.description('Show the current workspace configuration
|
|
1583
|
+
.description('Show the current workspace configuration')
|
|
1605
1584
|
.action(withAnalytics('init status', async () => {
|
|
1606
1585
|
try {
|
|
1607
1586
|
await handleInitStatusCommand();
|
|
@@ -173,13 +173,13 @@ export async function executeHeadlessRun(agent, sessionId, prompt, format = 'tex
|
|
|
173
173
|
let fatalError;
|
|
174
174
|
try {
|
|
175
175
|
for await (const event of await agent.stream(prompt, sessionId)) {
|
|
176
|
-
if (format === '
|
|
176
|
+
if (format === 'stream-json')
|
|
177
177
|
await writeHeadlessEvent(event);
|
|
178
178
|
switch (event.name) {
|
|
179
179
|
case 'approval:request': {
|
|
180
180
|
const required = toHeadlessApprovalRequired(event);
|
|
181
181
|
approvalRequired.push(required);
|
|
182
|
-
writeHeadlessTaggedLine('APPROVAL_REQUIRED', `${'
|
|
182
|
+
writeHeadlessTaggedLine('APPROVAL_REQUIRED', `${'tool_name' in required ? required.tool_name : required.approval_type}: ${required.message} (approval ${required.approval_id})`);
|
|
183
183
|
break;
|
|
184
184
|
}
|
|
185
185
|
case 'llm:tool-call': {
|
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
import { ApprovalType, type ApprovalRequest, type StreamingEvent } from '@dexto/core';
|
|
2
2
|
import type { HeadlessRunResult } from './headless.js';
|
|
3
|
-
|
|
3
|
+
/** How `dexto run` prints: the reply as text, one JSON result, or JSON events then the result. */
|
|
4
|
+
export type HeadlessOutputFormat = 'text' | 'json' | 'stream-json';
|
|
5
|
+
/**
|
|
6
|
+
* --json, --stream-json or --text as given, else JSON when stdout isn't a terminal (an agent or a
|
|
7
|
+
* pipe reads it) and text at one; null when more than one was given.
|
|
8
|
+
*/
|
|
9
|
+
export declare function chooseHeadlessOutput(options: {
|
|
10
|
+
json?: boolean;
|
|
11
|
+
streamJson?: boolean;
|
|
12
|
+
text?: boolean;
|
|
13
|
+
}, stdoutIsTerminal: boolean): HeadlessOutputFormat | null;
|
|
14
|
+
/**
|
|
15
|
+
* An approval the run asked for that no one here could give, so it was refused and the run went
|
|
16
|
+
* on without it: listed as the result's `permission_denials`.
|
|
17
|
+
*/
|
|
4
18
|
export type HeadlessApprovalRequired = {
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
approval_id: string;
|
|
20
|
+
session_id?: string;
|
|
7
21
|
message: string;
|
|
8
22
|
} & ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
approval_type: typeof ApprovalType.TOOL_APPROVAL;
|
|
24
|
+
tool_name: string;
|
|
25
|
+
tool_call_id: string;
|
|
12
26
|
} | {
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
approval_type: typeof ApprovalType.COMMAND_APPROVAL;
|
|
28
|
+
tool_name: string;
|
|
15
29
|
} | {
|
|
16
|
-
|
|
30
|
+
approval_type: Exclude<ApprovalRequest['type'], typeof ApprovalType.TOOL_APPROVAL | typeof ApprovalType.COMMAND_APPROVAL>;
|
|
17
31
|
});
|
|
18
32
|
export declare function toHeadlessApprovalRequired(request: ApprovalRequest): HeadlessApprovalRequired;
|
|
19
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The run's one result, for --json and as --stream-json's last line. An error says its code:
|
|
35
|
+
* `usage` for how it was called, otherwise `failed`. JSON output also puts the error on stderr as
|
|
36
|
+
* the CLI's other commands do.
|
|
37
|
+
*/
|
|
38
|
+
export declare function writeHeadlessResult(format: HeadlessOutputFormat, result: HeadlessRunResult, sessionId: string | undefined, errorCode?: 'usage' | 'failed'): Promise<void>;
|
|
20
39
|
export declare function writeHeadlessEvent(event: StreamingEvent): Promise<void>;
|
|
21
40
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,KA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|
|
@@ -1,42 +1,64 @@
|
|
|
1
1
|
import { ApprovalType } from '@dexto/core';
|
|
2
2
|
import { HEADLESS_APPROVAL_MESSAGE } from '../../approval/headless-approval-handler.js';
|
|
3
|
+
/**
|
|
4
|
+
* --json, --stream-json or --text as given, else JSON when stdout isn't a terminal (an agent or a
|
|
5
|
+
* pipe reads it) and text at one; null when more than one was given.
|
|
6
|
+
*/
|
|
7
|
+
export function chooseHeadlessOutput(options, stdoutIsTerminal) {
|
|
8
|
+
const chosen = [
|
|
9
|
+
options.json === true ? 'json' : null,
|
|
10
|
+
options.streamJson === true ? 'stream-json' : null,
|
|
11
|
+
options.text === true ? 'text' : null,
|
|
12
|
+
].filter((each) => each !== null);
|
|
13
|
+
if (chosen.length > 1)
|
|
14
|
+
return null;
|
|
15
|
+
return chosen[0] ?? (stdoutIsTerminal ? 'text' : 'json');
|
|
16
|
+
}
|
|
3
17
|
export function toHeadlessApprovalRequired(request) {
|
|
4
18
|
const correlation = {
|
|
5
|
-
|
|
6
|
-
...(request.sessionId !== undefined ? {
|
|
19
|
+
approval_id: request.approvalId,
|
|
20
|
+
...(request.sessionId !== undefined ? { session_id: request.sessionId } : {}),
|
|
7
21
|
message: HEADLESS_APPROVAL_MESSAGE,
|
|
8
22
|
};
|
|
9
23
|
switch (request.type) {
|
|
10
24
|
case ApprovalType.TOOL_APPROVAL:
|
|
11
25
|
return {
|
|
12
26
|
...correlation,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
approval_type: request.type,
|
|
28
|
+
tool_name: request.metadata.toolName,
|
|
29
|
+
tool_call_id: request.metadata.toolCallId,
|
|
16
30
|
};
|
|
17
31
|
case ApprovalType.COMMAND_APPROVAL:
|
|
18
32
|
return {
|
|
19
33
|
...correlation,
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
approval_type: request.type,
|
|
35
|
+
tool_name: request.metadata.toolName,
|
|
22
36
|
};
|
|
23
37
|
default:
|
|
24
|
-
return { ...correlation,
|
|
38
|
+
return { ...correlation, approval_type: request.type };
|
|
25
39
|
}
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The run's one result, for --json and as --stream-json's last line. An error says its code:
|
|
43
|
+
* `usage` for how it was called, otherwise `failed`. JSON output also puts the error on stderr as
|
|
44
|
+
* the CLI's other commands do.
|
|
45
|
+
*/
|
|
46
|
+
export async function writeHeadlessResult(format, result, sessionId, errorCode = 'failed') {
|
|
28
47
|
if (format === 'text')
|
|
29
48
|
return;
|
|
49
|
+
const error = result.fatalError
|
|
50
|
+
? { code: errorCode, message: result.fatalError.message }
|
|
51
|
+
: null;
|
|
52
|
+
if (error !== null)
|
|
53
|
+
process.stderr.write(`${JSON.stringify({ error })}\n`);
|
|
30
54
|
await writeJsonLineToStdout({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
: { type: result.fatalError ? 'error' : 'complete' }),
|
|
35
|
-
...(sessionId !== undefined ? { sessionId } : {}),
|
|
55
|
+
type: 'result',
|
|
56
|
+
status: result.fatalError ? 'failed' : 'completed',
|
|
57
|
+
...(sessionId !== undefined ? { session_id: sessionId } : {}),
|
|
36
58
|
...(result.finalMessage !== undefined ? { content: result.finalMessage } : {}),
|
|
37
|
-
...(result.totalTokens !== undefined ? {
|
|
38
|
-
...(
|
|
39
|
-
|
|
59
|
+
...(result.totalTokens !== undefined ? { total_tokens: result.totalTokens } : {}),
|
|
60
|
+
...(error !== null ? { error } : {}),
|
|
61
|
+
permission_denials: result.approvalRequired ?? [],
|
|
40
62
|
});
|
|
41
63
|
}
|
|
42
64
|
export async function writeHeadlessEvent(event) {
|
|
@@ -57,17 +79,17 @@ export async function writeHeadlessEvent(event) {
|
|
|
57
79
|
case 'llm:tool-call':
|
|
58
80
|
payload = {
|
|
59
81
|
type: 'tool_call',
|
|
60
|
-
|
|
82
|
+
tool_name: event.toolName,
|
|
61
83
|
args: event.args,
|
|
62
|
-
...(event.callId ? {
|
|
84
|
+
...(event.callId ? { call_id: event.callId } : {}),
|
|
63
85
|
};
|
|
64
86
|
break;
|
|
65
87
|
case 'llm:tool-result':
|
|
66
88
|
payload = {
|
|
67
89
|
type: 'tool_result',
|
|
68
|
-
|
|
90
|
+
tool_name: event.toolName,
|
|
69
91
|
success: event.success,
|
|
70
|
-
...(event.callId ? {
|
|
92
|
+
...(event.callId ? { call_id: event.callId } : {}),
|
|
71
93
|
...(!event.success && event.error ? { error: event.error } : {}),
|
|
72
94
|
};
|
|
73
95
|
break;
|
|
@@ -87,7 +109,7 @@ export async function writeHeadlessEvent(event) {
|
|
|
87
109
|
default:
|
|
88
110
|
return;
|
|
89
111
|
}
|
|
90
|
-
await writeJsonLineToStdout(
|
|
112
|
+
await writeJsonLineToStdout(payload);
|
|
91
113
|
}
|
|
92
114
|
function writeJsonLineToStdout(payload) {
|
|
93
115
|
return new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/run/register.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,kBAAkB,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CAoJtC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Option } from 'commander';
|
|
2
1
|
import { handleHeadlessApproval } from '../../approval/headless-approval-handler.js';
|
|
3
|
-
import { writeHeadlessResult } from './output.js';
|
|
2
|
+
import { chooseHeadlessOutput, writeHeadlessResult } from './output.js';
|
|
4
3
|
import { resolveAgentPath } from '@dexto/agent-management';
|
|
5
4
|
import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
|
|
6
5
|
export function registerRunCommand({ program, cliVersion, bootstrapAgentFromGlobalOpts, }) {
|
|
@@ -8,29 +7,42 @@ export function registerRunCommand({ program, cliVersion, bootstrapAgentFromGlob
|
|
|
8
7
|
.command('run [prompt]')
|
|
9
8
|
.description('Run a single prompt non-interactively (headless mode)')
|
|
10
9
|
.option('-m, --model <model>', 'Specify the LLM model to use for this run')
|
|
11
|
-
.
|
|
12
|
-
.
|
|
13
|
-
.
|
|
10
|
+
.option('--json', 'Print one JSON result (the default when stdout is not a terminal)')
|
|
11
|
+
.option('--stream-json', 'Print JSON events, one per line, ending with one result')
|
|
12
|
+
.option('--text', 'Print only the reply (the default at a terminal)')
|
|
14
13
|
.addHelpText('after', `
|
|
15
14
|
Examples:
|
|
16
15
|
$ dexto run "summarize this repository"
|
|
17
16
|
$ echo "fix lint errors" | dexto run
|
|
18
17
|
$ dexto run - < prompt.txt
|
|
18
|
+
$ dexto run "list the TODOs" --stream-json
|
|
19
|
+
|
|
20
|
+
Approvals no one here can give are refused and listed in the result's permission_denials.
|
|
21
|
+
Exit codes: 0 done, 1 failed, 2 usage, 3 needs sign-in or permission, 4 needs confirmation,
|
|
22
|
+
5 not found, 6 waiting on a person.
|
|
19
23
|
`)
|
|
20
24
|
.action(withAnalytics('run', async (promptArg, runOptions) => {
|
|
25
|
+
const format = chooseHeadlessOutput(runOptions, process.stdout.isTTY === true);
|
|
26
|
+
if (format === null) {
|
|
27
|
+
process.stderr.write('Pass --json, --stream-json or --text, only one.\n');
|
|
28
|
+
safeExit('run', 2, 'usage');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
21
31
|
let agent;
|
|
22
32
|
let sessionId;
|
|
23
33
|
let result = {};
|
|
24
34
|
let exitCode = 0;
|
|
25
35
|
let exitReason = 'ok';
|
|
36
|
+
let errorCode = 'failed';
|
|
26
37
|
try {
|
|
27
38
|
const { executeHeadlessRun, printHeadlessAssistantResponse, printHeadlessMcpStartup, printHeadlessRunSummary, resolveHeadlessPrompt, writeFinalMessageToStdout, writeHeadlessError, } = await import('./headless.js');
|
|
28
39
|
const prompt = await resolveHeadlessPrompt(promptArg);
|
|
29
40
|
if (prompt.trim().length === 0) {
|
|
30
41
|
writeHeadlessError('Prompt cannot be empty.');
|
|
31
42
|
result = { fatalError: new Error('Prompt cannot be empty.') };
|
|
32
|
-
exitCode =
|
|
43
|
+
exitCode = 2;
|
|
33
44
|
exitReason = 'empty-prompt';
|
|
45
|
+
errorCode = 'usage';
|
|
34
46
|
}
|
|
35
47
|
else {
|
|
36
48
|
const bootstrapOptions = runOptions.model
|
|
@@ -51,11 +63,11 @@ Examples:
|
|
|
51
63
|
cliVersion,
|
|
52
64
|
});
|
|
53
65
|
printHeadlessMcpStartup(agent);
|
|
54
|
-
const runResult = await executeHeadlessRun(agent, session.id, prompt,
|
|
66
|
+
const runResult = await executeHeadlessRun(agent, session.id, prompt, format);
|
|
55
67
|
result = runResult;
|
|
56
68
|
if (runResult.finalMessage !== undefined) {
|
|
57
69
|
printHeadlessAssistantResponse(runResult.finalMessage, runResult.totalTokens);
|
|
58
|
-
if (
|
|
70
|
+
if (format === 'text') {
|
|
59
71
|
writeFinalMessageToStdout(runResult.finalMessage);
|
|
60
72
|
}
|
|
61
73
|
}
|
|
@@ -96,7 +108,7 @@ Examples:
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
|
-
await writeHeadlessResult(
|
|
111
|
+
await writeHeadlessResult(format, result, sessionId, errorCode);
|
|
100
112
|
safeExit('run', exitCode, exitReason);
|
|
101
113
|
}));
|
|
102
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,EACnC,OAAO,EACP,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/session/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,EACnC,OAAO,EACP,4BAA4B,GAC/B,EAAE,6BAA6B,GAAG,IAAI,CA2GtC"}
|