dexto 1.6.2 → 1.6.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/oauth.ts"],"names":[],"mappings":"AA4CA,UAAU,WAAW;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EACC;QACI,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,GACD,SAAS,CAAC;CACnB;AA4BD,UAAU,0BAA0B;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpC;AAqSD,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAsB,eAAe,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,0BAA+B,GACzC,OAAO,CAAC,iBAAiB,CAAC,CAyC5B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CA8BjF;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAKlC,CAAC"}
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/oauth.ts"],"names":[],"mappings":"AA8EA,UAAU,WAAW;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EACC;QACI,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,GACD,SAAS,CAAC;CACnB;AA4BD,UAAU,0BAA0B;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpC;AAqSD,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAsB,eAAe,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,0BAA+B,GACzC,OAAO,CAAC,iBAAiB,CAAC,CAyC5B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CA8BjF;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAKlC,CAAC"}
@@ -15,17 +15,43 @@ import * as querystring from 'querystring';
15
15
  import chalk from 'chalk';
16
16
  import * as p from '@clack/prompts';
17
17
  import { logger } from '@dexto/core';
18
- import { readFileSync } from 'node:fs';
18
+ import { getDextoPackageRoot } from '@dexto/agent-management';
19
+ import { existsSync, readFileSync } from 'node:fs';
20
+ import path from 'node:path';
19
21
  import { SUPABASE_URL, SUPABASE_ANON_KEY } from './constants.js';
20
22
  // Track active OAuth callback servers by port for cleanup
21
23
  const oauthStateStore = new Map();
24
+ function resolveLogoPath() {
25
+ const packageRoot = getDextoPackageRoot();
26
+ if (packageRoot) {
27
+ const standaloneAssetPath = path.join(packageRoot, 'dist', 'cli', 'assets', 'dexto-logo.svg');
28
+ if (existsSync(standaloneAssetPath)) {
29
+ return standaloneAssetPath;
30
+ }
31
+ }
32
+ try {
33
+ const localAssetPath = new URL('../assets/dexto-logo.svg', import.meta.url);
34
+ const resolvedPath = url.fileURLToPath(localAssetPath);
35
+ if (existsSync(resolvedPath)) {
36
+ return resolvedPath;
37
+ }
38
+ }
39
+ catch {
40
+ // Ignore URL/path errors and return null.
41
+ }
42
+ return null;
43
+ }
22
44
  const DEXTO_LOGO_DATA_URL = (() => {
23
45
  try {
24
- const svg = readFileSync(new URL('../assets/dexto-logo.svg', import.meta.url), 'utf-8');
46
+ const logoPath = resolveLogoPath();
47
+ if (!logoPath) {
48
+ return '';
49
+ }
50
+ const svg = readFileSync(logoPath, 'utf-8');
25
51
  return `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;
26
52
  }
27
53
  catch (error) {
28
- logger.warn(`Failed to load Dexto logo asset for OAuth screen: ${error instanceof Error ? error.message : String(error)}`);
54
+ logger.debug(`Failed to load Dexto logo asset for OAuth screen: ${error instanceof Error ? error.message : String(error)}`);
29
55
  return '';
30
56
  }
31
57
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"scaffolding-utils.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/scaffolding-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AASpC,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,0BAA0B,CAAC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C,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpE"}
@@ -1,14 +1,48 @@
1
1
  import fs from 'fs-extra';
2
2
  import path from 'path';
3
+ import { existsSync, readFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
3
5
  import chalk from 'chalk';
4
- import { createRequire } from 'module';
6
+ import { getDextoPackageRoot } from '@dexto/agent-management';
5
7
  import { executeWithTimeout } from './execute.js';
6
8
  import { textOrExit } from './prompt-helpers.js';
7
9
  import { getPackageManager, getPackageManagerInstallCommand } from './package-mgmt.js';
8
- const require = createRequire(import.meta.url);
9
- const cliPackageJson = require('../../../package.json');
10
+ function readVersionFromPackageJson(packageJsonPath) {
11
+ if (!existsSync(packageJsonPath)) {
12
+ return undefined;
13
+ }
14
+ try {
15
+ const content = readFileSync(packageJsonPath, 'utf-8');
16
+ const pkg = JSON.parse(content);
17
+ if (typeof pkg.version === 'string' && pkg.version.length > 0) {
18
+ return pkg.version;
19
+ }
20
+ }
21
+ catch {
22
+ // Ignore parse/read errors and fall back.
23
+ }
24
+ return undefined;
25
+ }
26
+ function resolveCliPackageVersion() {
27
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
28
+ const localPackageJsonPath = path.resolve(scriptDir, '../../../package.json');
29
+ const localVersion = readVersionFromPackageJson(localPackageJsonPath);
30
+ if (localVersion) {
31
+ return localVersion;
32
+ }
33
+ const packageRoot = getDextoPackageRoot();
34
+ if (packageRoot) {
35
+ const packageJsonPath = path.join(packageRoot, 'package.json');
36
+ const packageVersion = readVersionFromPackageJson(packageJsonPath);
37
+ if (packageVersion) {
38
+ return packageVersion;
39
+ }
40
+ }
41
+ return process.env.DEXTO_CLI_VERSION;
42
+ }
43
+ const cliPackageVersion = resolveCliPackageVersion();
10
44
  export function getDextoCliVersion() {
11
- const version = process.env.DEXTO_CLI_VERSION ?? cliPackageJson.version;
45
+ const version = process.env.DEXTO_CLI_VERSION ?? cliPackageVersion;
12
46
  if (!version) {
13
47
  throw new Error('Could not determine dexto CLI version');
14
48
  }
@@ -1,17 +1,50 @@
1
1
  import { existsSync, readFileSync } from 'fs';
2
- import { createRequire } from 'module';
3
2
  import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
4
  import { Command } from 'commander';
5
5
  import * as p from '@clack/prompts';
6
6
  import chalk from 'chalk';
7
7
  import { initAnalytics, capture, getWebUIAnalyticsConfig } from './analytics/index.js';
8
8
  import { withAnalytics, safeExit, ExitSignal } from './analytics/wrapper.js';
9
9
  import { createFileSessionLoggerFactory } from './utils/session-logger-factory.js';
10
- // Use createRequire to import package.json without experimental warning
11
- const require = createRequire(import.meta.url);
12
- const pkg = require('../package.json');
10
+ function readVersionFromPackageJson(packageJsonPath) {
11
+ if (!existsSync(packageJsonPath)) {
12
+ return undefined;
13
+ }
14
+ try {
15
+ const content = readFileSync(packageJsonPath, 'utf-8');
16
+ const pkg = JSON.parse(content);
17
+ if (typeof pkg.version === 'string' && pkg.version.length > 0) {
18
+ return pkg.version;
19
+ }
20
+ }
21
+ catch {
22
+ // Ignore parse/read errors and fall back.
23
+ }
24
+ return undefined;
25
+ }
26
+ function resolveCliVersion() {
27
+ // Regular installs (npm/pnpm): package.json is next to dist/.
28
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
29
+ const localPackageJsonPath = path.resolve(scriptDir, '..', 'package.json');
30
+ const localVersion = readVersionFromPackageJson(localPackageJsonPath);
31
+ if (localVersion) {
32
+ return localVersion;
33
+ }
34
+ // Standalone release archives ship package.json next to the executable.
35
+ const packageRoot = getDextoPackageRoot();
36
+ if (packageRoot) {
37
+ const packageJsonPath = path.join(packageRoot, 'package.json');
38
+ const packageVersion = readVersionFromPackageJson(packageJsonPath);
39
+ if (packageVersion) {
40
+ return packageVersion;
41
+ }
42
+ }
43
+ return process.env.DEXTO_CLI_VERSION || '0.0.0';
44
+ }
45
+ const cliVersion = resolveCliVersion();
13
46
  // Set CLI version for Dexto Gateway usage tracking
14
- process.env.DEXTO_CLI_VERSION = pkg.version;
47
+ process.env.DEXTO_CLI_VERSION = cliVersion;
15
48
  // Populate DEXTO_API_KEY for Dexto gateway routing
16
49
  // Resolution order in getDextoApiKey():
17
50
  // 1. Explicit env var (CI, testing, account override)
@@ -26,7 +59,7 @@ if (isDextoAuthEnabled()) {
26
59
  }
27
60
  import { logger, getProviderFromModel, getAllSupportedModels, startLlmRegistryAutoUpdate, DextoAgent, isPath, resolveApiKeyForProvider, getPrimaryApiKeyEnvVar, } from '@dexto/core';
28
61
  import { applyImageDefaults, cleanNullValues, AgentConfigSchema, loadImage, resolveServicesFromConfig, setImageImporter, toDextoAgentOptions, } from '@dexto/agent-config';
29
- import { resolveAgentPath, loadAgentConfig, globalPreferencesExist, loadGlobalPreferences, resolveBundledScript, } from '@dexto/agent-management';
62
+ import { getDextoPackageRoot, resolveAgentPath, loadAgentConfig, globalPreferencesExist, loadGlobalPreferences, resolveBundledScript, } from '@dexto/agent-management';
30
63
  import { startHonoApiServer } from './api/server-hono.js';
31
64
  import { validateCliOptions, handleCliOptionsError } from './cli/utils/options.js';
32
65
  import { validateAgentConfig } from './cli/utils/config-validation.js';
@@ -50,10 +83,10 @@ const program = new Command();
50
83
  // Resolve images via the Dexto image store when installed; fall back to host imports (pnpm-safe).
51
84
  setImageImporter((specifier) => importImageModule(specifier));
52
85
  // Initialize analytics early (no-op if disabled)
53
- await initAnalytics({ appVersion: pkg.version });
86
+ await initAnalytics({ appVersion: cliVersion });
54
87
  // Start version check early (non-blocking)
55
88
  // We'll check the result later and display notification for interactive modes
56
- const versionCheckPromise = checkForUpdates(pkg.version);
89
+ const versionCheckPromise = checkForUpdates(cliVersion);
57
90
  // Start self-updating LLM registry refresh (models.dev + OpenRouter mapping).
58
91
  // Uses a cached snapshot on disk and refreshes in the background.
59
92
  startLlmRegistryAutoUpdate();
@@ -61,7 +94,7 @@ startLlmRegistryAutoUpdate();
61
94
  program
62
95
  .name('dexto')
63
96
  .description('AI-powered CLI and WebUI for interacting with MCP servers.')
64
- .version(pkg.version, '-v, --version', 'output the current version')
97
+ .version(cliVersion, '-v, --version', 'output the current version')
65
98
  .option('-a, --agent <id|path>', 'Agent ID or path to agent config file')
66
99
  .option('-p, --prompt <text>', 'Start the interactive CLI and immediately run the prompt')
67
100
  .option('-s, --strict', 'Require all server connections to succeed')
package/dist/index.js CHANGED
@@ -1,5 +1,17 @@
1
1
  #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
2
4
  import { applyLayeredEnvironmentLoading } from './utils/env.js';
5
+ /**
6
+ * Standalone binaries are distributed with a sibling `dist/` directory.
7
+ * When present, set package root so shared path resolvers can find bundled assets.
8
+ */
9
+ if (!process.env.DEXTO_PACKAGE_ROOT) {
10
+ const executableDir = dirname(process.execPath);
11
+ if (existsSync(join(executableDir, 'dist'))) {
12
+ process.env.DEXTO_PACKAGE_ROOT = executableDir;
13
+ }
14
+ }
3
15
  // Ensure layered env vars are loaded before the main CLI module executes.
4
16
  await applyLayeredEnvironmentLoading();
5
17
  await import('./index-main.js');
package/dist/web.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAkBnD"}
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAgBnD"}
package/dist/web.js CHANGED
@@ -7,22 +7,29 @@
7
7
  import { existsSync } from 'fs';
8
8
  import path from 'path';
9
9
  import { fileURLToPath } from 'url';
10
+ import { getDextoPackageRoot } from '@dexto/agent-management';
11
+ function isValidWebRoot(webRootPath) {
12
+ if (!existsSync(webRootPath)) {
13
+ return false;
14
+ }
15
+ // Verify index.html exists (Vite output)
16
+ const indexPath = path.join(webRootPath, 'index.html');
17
+ return existsSync(indexPath);
18
+ }
10
19
  /**
11
20
  * Discovers the webui path for embedded Vite build.
12
21
  * @returns Absolute path to webui dist folder, or undefined if not found
13
22
  */
14
23
  export function resolveWebRoot() {
15
- // Path discovery logic for the built webui
16
24
  const scriptDir = path.dirname(fileURLToPath(import.meta.url));
17
- // Look for embedded webui in CLI's dist folder
18
- const webuiPath = path.resolve(scriptDir, 'webui');
19
- if (!existsSync(webuiPath)) {
20
- return undefined;
21
- }
22
- // Verify index.html exists (Vite output)
23
- const indexPath = path.join(webuiPath, 'index.html');
24
- if (!existsSync(indexPath)) {
25
- return undefined;
25
+ const roots = Array.from(new Set([getDextoPackageRoot(), path.dirname(process.execPath), scriptDir])).filter((value) => Boolean(value));
26
+ for (const root of roots) {
27
+ const candidates = [path.resolve(root, 'webui'), path.resolve(root, 'dist', 'webui')];
28
+ for (const webRootPath of candidates) {
29
+ if (isValidWebRoot(webRootPath)) {
30
+ return webRootPath;
31
+ }
32
+ }
26
33
  }
27
- return webuiPath;
34
+ return undefined;
28
35
  }