dexto 1.13.5 → 1.14.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/api/mcp/http-gateway.d.ts +21 -0
- package/dist/api/mcp/http-gateway.d.ts.map +1 -0
- package/dist/api/mcp/http-gateway.js +110 -0
- package/dist/api/mcp/tool-aggregation-handler.d.ts +9 -6
- package/dist/api/mcp/tool-aggregation-handler.d.ts.map +1 -1
- package/dist/api/mcp/tool-aggregation-handler.js +203 -70
- package/dist/api/server-hono.d.ts +2 -0
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +377 -276
- package/dist/cli/approval/headless-approval-handler.d.ts +4 -0
- package/dist/cli/approval/headless-approval-handler.d.ts.map +1 -0
- package/dist/cli/approval/headless-approval-handler.js +19 -0
- package/dist/cli/auth/api-client.js +1 -1
- package/dist/cli/auth/constants.d.ts +1 -0
- package/dist/cli/auth/constants.d.ts.map +1 -1
- package/dist/cli/auth/constants.js +2 -1
- package/dist/cli/auth/dexto-api-key.d.ts.map +1 -1
- package/dist/cli/auth/dexto-api-key.js +3 -0
- package/dist/cli/auth/login-persistence.d.ts +1 -1
- package/dist/cli/auth/login-persistence.d.ts.map +1 -1
- package/dist/cli/auth/login-persistence.js +9 -1
- package/dist/cli/auth/service.d.ts +2 -0
- package/dist/cli/auth/service.d.ts.map +1 -1
- package/dist/cli/auth/service.js +1 -0
- package/dist/cli/commands/agents/register.d.ts.map +1 -1
- package/dist/cli/commands/agents/register.js +0 -1
- package/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +9 -4
- package/dist/cli/commands/cloud/discovery.d.ts +17 -0
- package/dist/cli/commands/cloud/discovery.d.ts.map +1 -0
- package/dist/cli/commands/cloud/discovery.js +88 -0
- package/dist/cli/commands/cloud/register.d.ts +3 -0
- package/dist/cli/commands/cloud/register.d.ts.map +1 -0
- package/dist/cli/commands/cloud/register.js +27 -0
- package/dist/cli/commands/mcp/register.d.ts +1 -1
- package/dist/cli/commands/mcp/register.d.ts.map +1 -1
- package/dist/cli/commands/mcp/register.js +259 -26
- package/dist/cli/commands/mcp/standalone.d.ts +98 -0
- package/dist/cli/commands/mcp/standalone.d.ts.map +1 -0
- package/dist/cli/commands/mcp/standalone.js +489 -0
- package/dist/cli/commands/run/headless.d.ts +3 -1
- package/dist/cli/commands/run/headless.d.ts.map +1 -1
- package/dist/cli/commands/run/headless.js +13 -1
- package/dist/cli/commands/run/output.d.ts +21 -0
- package/dist/cli/commands/run/output.d.ts.map +1 -0
- package/dist/cli/commands/run/output.js +95 -0
- package/dist/cli/commands/run/register.d.ts.map +1 -1
- package/dist/cli/commands/run/register.js +27 -3
- package/dist/cli/commands/setup.d.ts +2 -2
- package/dist/cli/commands/trace/client.d.ts +2 -2
- package/dist/cli/utils/options.js +3 -1
- package/dist/config/cli-overrides.d.ts +3 -1
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +9 -3
- package/dist/index-main.js +14 -11
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +6 -0
- package/dist/utils/graceful-shutdown.d.ts +1 -1
- package/dist/utils/graceful-shutdown.d.ts.map +1 -1
- package/dist/utils/graceful-shutdown.js +28 -9
- package/package.json +14 -14
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ApprovalRequest, type AgentEventBus, type ApprovalResponse } from '@dexto/core';
|
|
2
|
+
export declare const HEADLESS_APPROVAL_MESSAGE = "This operation requires interactive approval. Run the task in the Dexto TUI to review it.";
|
|
3
|
+
export declare function handleHeadlessApproval(request: ApprovalRequest, eventBus: Pick<AgentEventBus, 'emit'>, runSessionId: string | undefined): Promise<ApprovalResponse>;
|
|
4
|
+
//# sourceMappingURL=headless-approval-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-approval-handler.d.ts","sourceRoot":"","sources":["../../../src/cli/approval/headless-approval-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,yBAAyB,8FACyD,CAAC;AAEhG,wBAAsB,sBAAsB,CACxC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GACjC,OAAO,CAAC,gBAAgB,CAAC,CAiB3B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApprovalStatus, DenialReason, } from '@dexto/core';
|
|
2
|
+
export const HEADLESS_APPROVAL_MESSAGE = 'This operation requires interactive approval. Run the task in the Dexto TUI to review it.';
|
|
3
|
+
export async function handleHeadlessApproval(request, eventBus, runSessionId) {
|
|
4
|
+
// Attribute legacy unscoped requests to this headless run without changing the denial envelope.
|
|
5
|
+
const eventScope = request.sessionId === undefined && runSessionId !== undefined
|
|
6
|
+
? { sessionId: runSessionId }
|
|
7
|
+
: {};
|
|
8
|
+
eventBus.emit('approval:request', { ...request, ...eventScope });
|
|
9
|
+
const response = {
|
|
10
|
+
approvalId: request.approvalId,
|
|
11
|
+
status: ApprovalStatus.DENIED,
|
|
12
|
+
reason: DenialReason.SYSTEM_DENIED,
|
|
13
|
+
message: HEADLESS_APPROVAL_MESSAGE,
|
|
14
|
+
...(request.sessionId !== undefined ? { sessionId: request.sessionId } : {}),
|
|
15
|
+
...(request.hostRuntime !== undefined ? { hostRuntime: request.hostRuntime } : {}),
|
|
16
|
+
};
|
|
17
|
+
eventBus.emit('approval:response', { ...response, ...eventScope });
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
@@ -478,7 +478,7 @@ export class DextoApiClient {
|
|
|
478
478
|
headers: {
|
|
479
479
|
'Content-Type': 'application/json',
|
|
480
480
|
},
|
|
481
|
-
body: JSON.stringify({ client }),
|
|
481
|
+
body: JSON.stringify({ clientId: client }),
|
|
482
482
|
signal: this.createRequestSignal(options.signal),
|
|
483
483
|
});
|
|
484
484
|
if (!response.ok) {
|
|
@@ -25,6 +25,7 @@ export declare const DEXTO_API_URL: string;
|
|
|
25
25
|
/**
|
|
26
26
|
* Dexto app URL for auth/key/account control-plane endpoints.
|
|
27
27
|
*/
|
|
28
|
+
export declare const DEFAULT_DEXTO_PLATFORM_URL = "https://app.dexto.ai";
|
|
28
29
|
export declare const DEXTO_PLATFORM_URL: string;
|
|
29
30
|
export declare const DEXTO_PUBLIC_API_URL: string;
|
|
30
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,QAAyE,CAAC;AACnG,eAAO,MAAM,iBAAiB,QAEwL,CAAC;AAEvN;;GAEG;AACH,eAAO,MAAM,aAAa,QAAsD,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,QAAyE,CAAC;AACnG,eAAO,MAAM,iBAAiB,QAEwL,CAAC;AAEvN;;GAEG;AACH,eAAO,MAAM,aAAa,QAAsD,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE,eAAO,MAAM,kBAAkB,QAA+D,CAAC;AAE/F,eAAO,MAAM,oBAAoB,QAA6D,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,iBAAiB,QACwD,CAAC"}
|
|
@@ -27,7 +27,8 @@ export const DEXTO_API_URL = process.env.DEXTO_API_URL || 'https://app.dexto.ai'
|
|
|
27
27
|
/**
|
|
28
28
|
* Dexto app URL for auth/key/account control-plane endpoints.
|
|
29
29
|
*/
|
|
30
|
-
export const
|
|
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;
|
|
31
32
|
export const DEXTO_PUBLIC_API_URL = process.env.DEXTO_PUBLIC_API_URL || 'https://api.dexto.ai';
|
|
32
33
|
/**
|
|
33
34
|
* Dexto Nova credits purchase URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexto-api-key.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/dexto-api-key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dexto-api-key.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/dexto-api-key.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvF,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,+BAA+B,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACzE;AAaD;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BxE;AAED,wBAAsB,wBAAwB,CAAC,OAAO,GAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC;IAC9F,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC,CAsDD;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC,CA+D/D"}
|
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { ensureDextoGlobalDirectory, getDextoEnvPath, logger } from '@dexto/core';
|
|
4
4
|
import { getDextoApiClient } from './api-client.js';
|
|
5
5
|
import { loadAuth, storeAuth } from './service.js';
|
|
6
|
+
import { DEXTO_PLATFORM_URL } from './constants.js';
|
|
6
7
|
async function ensureOwnerOnlyPermissions(filePath) {
|
|
7
8
|
try {
|
|
8
9
|
await fs.chmod(filePath, 0o600);
|
|
@@ -131,6 +132,7 @@ export async function ensureDextoApiKeyForAuthToken(authToken, options = {}) {
|
|
|
131
132
|
dextoApiKey: rotated.dextoApiKey,
|
|
132
133
|
dextoKeyId: rotated.keyId,
|
|
133
134
|
dextoApiKeySource: 'provisioned',
|
|
135
|
+
dextoPlatformUrl: new URL(DEXTO_PLATFORM_URL).origin,
|
|
134
136
|
});
|
|
135
137
|
await saveDextoApiKeyToEnv(rotated.dextoApiKey);
|
|
136
138
|
status('success', 'New key provisioned');
|
|
@@ -143,6 +145,7 @@ export async function ensureDextoApiKeyForAuthToken(authToken, options = {}) {
|
|
|
143
145
|
dextoApiKey: provisioned.dextoApiKey,
|
|
144
146
|
dextoKeyId: provisioned.keyId,
|
|
145
147
|
dextoApiKeySource: 'provisioned',
|
|
148
|
+
dextoPlatformUrl: new URL(DEXTO_PLATFORM_URL).origin,
|
|
146
149
|
});
|
|
147
150
|
await saveDextoApiKeyToEnv(provisioned.dextoApiKey);
|
|
148
151
|
status('success', 'Dexto API key provisioned');
|
|
@@ -11,5 +11,5 @@ export interface PersistedLoginResult {
|
|
|
11
11
|
hasDextoApiKey: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare function persistOAuthLoginResult(result: OAuthResult, options?: PersistOAuthLoginOptions): Promise<PersistedLoginResult>;
|
|
14
|
-
export declare function persistDeviceApiKeyLoginResult(result: DeviceApiKeyLoginResult): Promise<PersistedLoginResult>;
|
|
14
|
+
export declare function persistDeviceApiKeyLoginResult(result: DeviceApiKeyLoginResult, platformUrl?: string): Promise<PersistedLoginResult>;
|
|
15
15
|
//# sourceMappingURL=login-persistence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-persistence.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/login-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAiC,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"login-persistence.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/login-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAiC,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,WAAW,wBAAwB;IACrC,iBAAiB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAClF;AAED,MAAM,WAAW,oBAAoB;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CAC3B;AAoDD,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CAyB/B;AAED,wBAAsB,8BAA8B,CAChD,MAAM,EAAE,uBAAuB,EAC/B,WAAW,GAAE,MAA2B,GACzC,OAAO,CAAC,oBAAoB,CAAC,CAa/B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ensureDextoApiKeyForAuthToken } from './dexto-api-key.js';
|
|
2
2
|
import { loadAuth, storeAuth } from './service.js';
|
|
3
|
+
import { DEXTO_PLATFORM_URL } from './constants.js';
|
|
3
4
|
function isSameAuthenticatedUser(existingAuth, user) {
|
|
4
5
|
if (!existingAuth || !user) {
|
|
5
6
|
return false;
|
|
@@ -16,6 +17,9 @@ function getPreservedDextoApiKey(existingAuth, user) {
|
|
|
16
17
|
if (!existingAuth?.dextoApiKey || !isSameAuthenticatedUser(existingAuth, user)) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
20
|
+
const keyOrigin = existingAuth.dextoPlatformUrl ?? 'https://app.dexto.ai';
|
|
21
|
+
if (new URL(keyOrigin).origin !== new URL(DEXTO_PLATFORM_URL).origin)
|
|
22
|
+
return null;
|
|
19
23
|
const isProvisionedKey = existingAuth.dextoApiKeySource === 'provisioned' ||
|
|
20
24
|
(existingAuth.dextoApiKeySource === undefined && Boolean(existingAuth.dextoKeyId));
|
|
21
25
|
if (!isProvisionedKey) {
|
|
@@ -25,6 +29,9 @@ function getPreservedDextoApiKey(existingAuth, user) {
|
|
|
25
29
|
dextoApiKey: existingAuth.dextoApiKey,
|
|
26
30
|
...(existingAuth.dextoKeyId ? { dextoKeyId: existingAuth.dextoKeyId } : {}),
|
|
27
31
|
dextoApiKeySource: 'provisioned',
|
|
32
|
+
...(existingAuth.dextoPlatformUrl
|
|
33
|
+
? { dextoPlatformUrl: existingAuth.dextoPlatformUrl }
|
|
34
|
+
: {}),
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
export async function persistOAuthLoginResult(result, options = {}) {
|
|
@@ -50,11 +57,12 @@ export async function persistOAuthLoginResult(result, options = {}) {
|
|
|
50
57
|
hasDextoApiKey: Boolean(ensured?.dextoApiKey ?? preservedDextoApiKey?.dextoApiKey),
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
|
-
export async function persistDeviceApiKeyLoginResult(result) {
|
|
60
|
+
export async function persistDeviceApiKeyLoginResult(result, platformUrl = DEXTO_PLATFORM_URL) {
|
|
54
61
|
await storeAuth({
|
|
55
62
|
dextoApiKey: result.dextoApiKey,
|
|
56
63
|
dextoKeyId: result.dextoKeyId,
|
|
57
64
|
dextoApiKeySource: 'provisioned',
|
|
65
|
+
dextoPlatformUrl: new URL(platformUrl).origin,
|
|
58
66
|
createdAt: Date.now(),
|
|
59
67
|
});
|
|
60
68
|
return {
|
|
@@ -9,6 +9,8 @@ export interface AuthConfig {
|
|
|
9
9
|
/** Dexto API key for gateway access (from --api-key or provisioned after OAuth) */
|
|
10
10
|
dextoApiKey?: string | undefined;
|
|
11
11
|
dextoKeyId?: string | undefined;
|
|
12
|
+
/** Application origin that issued the saved API key; absent for legacy credentials. */
|
|
13
|
+
dextoPlatformUrl?: string | undefined;
|
|
12
14
|
dextoApiKeySource?: 'provisioned' | 'user-supplied' | undefined;
|
|
13
15
|
}
|
|
14
16
|
export declare function storeAuth(config: AuthConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/service.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACvB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS,CAAC;CACnE;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/service.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACvB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iBAAiB,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS,CAAC;CACnE;AAmBD,wBAAsB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjE;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA4B3D;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAOhD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAGxD;AAsDD,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAE3D;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAElE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ7D;AA8CD,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
package/dist/cli/auth/service.js
CHANGED
|
@@ -16,6 +16,7 @@ const AuthConfigSchema = z
|
|
|
16
16
|
createdAt: z.number(),
|
|
17
17
|
dextoApiKey: z.string().optional(),
|
|
18
18
|
dextoKeyId: z.string().optional(),
|
|
19
|
+
dextoPlatformUrl: z.string().url().optional(),
|
|
19
20
|
dextoApiKeySource: z.enum(['provisioned', 'user-supplied']).optional(),
|
|
20
21
|
})
|
|
21
22
|
.refine((data) => data.token || data.dextoApiKey, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/agents/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,MAAM,WAAW,4BAA4B;IACzC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,4BAA4B,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/agents/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,MAAM,WAAW,4BAA4B;IACzC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,4BAA4B,GAAG,IAAI,CA+FrF"}
|
|
@@ -5,7 +5,6 @@ export function registerAgentsCommand({ program }) {
|
|
|
5
5
|
.command('install [agents...]')
|
|
6
6
|
.description('Install agents from registry or custom YAML files/directories')
|
|
7
7
|
.option('--all', 'Install all available agents from registry')
|
|
8
|
-
.option('--no-inject-preferences', 'Skip injecting global preferences into installed agents')
|
|
9
8
|
.option('--force', 'Force reinstall even if agent is already installed')
|
|
10
9
|
.addHelpText('after', `
|
|
11
10
|
Examples:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAgBD,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsEzF;AAGD,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD;AAED,wBAAsB,iBAAiB,CAAC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7F"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// packages/cli/src/cli/commands/auth/login.ts
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import * as p from '@clack/prompts';
|
|
4
|
-
import {
|
|
4
|
+
import { DEXTO_PLATFORM_URL } from '../../auth/constants.js';
|
|
5
|
+
import { DextoApiClient, getDextoApiClient, isAuthenticated, loadAuth, performDeviceCodeLogin, persistDeviceApiKeyLoginResult, persistOAuthLoginResult, storeAuth, } from '../../auth/index.js';
|
|
5
6
|
function isCancellationError(errorMessage) {
|
|
6
7
|
const lower = errorMessage.toLowerCase();
|
|
7
8
|
return (lower.includes('canceled') ||
|
|
@@ -36,7 +37,9 @@ export async function handleLoginCommand(options = {}) {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
if (options.apiKey) {
|
|
39
|
-
const client =
|
|
40
|
+
const client = options.platformUrl
|
|
41
|
+
? new DextoApiClient(options.platformUrl)
|
|
42
|
+
: getDextoApiClient();
|
|
40
43
|
const isValid = await client.validateDextoApiKey(options.apiKey);
|
|
41
44
|
if (!isValid) {
|
|
42
45
|
throw new Error('Invalid API key provided - validation failed');
|
|
@@ -44,6 +47,7 @@ export async function handleLoginCommand(options = {}) {
|
|
|
44
47
|
await storeAuth({
|
|
45
48
|
dextoApiKey: options.apiKey,
|
|
46
49
|
dextoApiKeySource: 'user-supplied',
|
|
50
|
+
dextoPlatformUrl: new URL(options.platformUrl ?? DEXTO_PLATFORM_URL).origin,
|
|
47
51
|
createdAt: Date.now(),
|
|
48
52
|
});
|
|
49
53
|
console.log(chalk.green('✅ Dexto API key saved'));
|
|
@@ -78,8 +82,9 @@ export async function handleAutoLogin() {
|
|
|
78
82
|
}
|
|
79
83
|
export async function handleDeviceLogin(options = {}) {
|
|
80
84
|
try {
|
|
85
|
+
const platformUrl = options.platformUrl ?? DEXTO_PLATFORM_URL;
|
|
81
86
|
const result = await performDeviceCodeLogin({
|
|
82
|
-
|
|
87
|
+
apiUrl: platformUrl,
|
|
83
88
|
onPrompt: (prompt) => {
|
|
84
89
|
console.log(chalk.cyan('\nUse any browser to complete login:'));
|
|
85
90
|
if (prompt.verificationUrlComplete) {
|
|
@@ -93,7 +98,7 @@ export async function handleDeviceLogin(options = {}) {
|
|
|
93
98
|
console.log(chalk.dim(` • Code expires in ~${Math.ceil(prompt.expiresIn / 60)} min`));
|
|
94
99
|
},
|
|
95
100
|
});
|
|
96
|
-
const persisted = await persistDeviceApiKeyLoginResult(result);
|
|
101
|
+
const persisted = await persistDeviceApiKeyLoginResult(result, platformUrl);
|
|
97
102
|
console.log(chalk.dim(`\nSaved Dexto API key ${persisted.keyId ?? ''}`.trim()));
|
|
98
103
|
}
|
|
99
104
|
catch (error) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CloudDiscoveryCommand = {
|
|
2
|
+
command: 'sources';
|
|
3
|
+
} | {
|
|
4
|
+
command: 'search';
|
|
5
|
+
query: string;
|
|
6
|
+
} | {
|
|
7
|
+
command: 'describe';
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
export interface CloudDiscoveryOptions {
|
|
11
|
+
json?: boolean;
|
|
12
|
+
limit?: string;
|
|
13
|
+
offset?: string;
|
|
14
|
+
platformUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function runCloudDiscovery(command: CloudDiscoveryCommand, options: CloudDiscoveryOptions): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cloud/discovery.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAC3B;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC5C,MAAM,WAAW,qBAAqB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,qBAAqB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAyGjB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CloudClientError, createDextoCloudClient } from '@dexto/client-sdk/cloud';
|
|
2
|
+
import { ZodError } from 'zod';
|
|
3
|
+
import { DEFAULT_DEXTO_PLATFORM_URL } from '../../auth/constants.js';
|
|
4
|
+
import { getIncomingEnvironmentVariable } from '../../../utils/env.js';
|
|
5
|
+
import { loadAuth } from '../../auth/service.js';
|
|
6
|
+
export async function runCloudDiscovery(command, options) {
|
|
7
|
+
try {
|
|
8
|
+
const environmentToken = getIncomingEnvironmentVariable('DEXTO_API_KEY')?.trim();
|
|
9
|
+
const environmentOrigin = getIncomingEnvironmentVariable('DEXTO_PLATFORM_URL') || undefined;
|
|
10
|
+
const requestedOrigin = options.platformUrl ?? environmentOrigin ?? DEFAULT_DEXTO_PLATFORM_URL;
|
|
11
|
+
const hasOriginOverride = options.platformUrl !== undefined || environmentOrigin !== undefined;
|
|
12
|
+
const auth = await loadAuth();
|
|
13
|
+
const savedToken = auth?.dextoApiKey?.trim();
|
|
14
|
+
const token = environmentToken || savedToken;
|
|
15
|
+
if (!token)
|
|
16
|
+
throw new CloudClientError('configuration_error', 'Run dexto login or supply DEXTO_API_KEY to discover Cloud capabilities.');
|
|
17
|
+
let origin = requestedOrigin;
|
|
18
|
+
if (savedToken === token) {
|
|
19
|
+
const credentialOrigin = auth?.dextoPlatformUrl;
|
|
20
|
+
if (!credentialOrigin) {
|
|
21
|
+
throw new CloudClientError('configuration_error', 'Saved credential has no platform origin. Run dexto login --platform-url <application-origin> again before discovering Cloud capabilities.');
|
|
22
|
+
}
|
|
23
|
+
if (hasOriginOverride && new URL(origin).origin !== new URL(credentialOrigin).origin) {
|
|
24
|
+
throw new CloudClientError('configuration_error', 'Saved credential belongs to a different platform origin. Login to the requested platform or supply a different DEXTO_API_KEY issued by it.');
|
|
25
|
+
}
|
|
26
|
+
origin = credentialOrigin;
|
|
27
|
+
}
|
|
28
|
+
const client = createDextoCloudClient({ origin, token, fetch: globalThis.fetch });
|
|
29
|
+
const pagination = {
|
|
30
|
+
...(options.limit === undefined ? {} : { limit: Number(options.limit) }),
|
|
31
|
+
...(options.offset === undefined ? {} : { offset: Number(options.offset) }),
|
|
32
|
+
};
|
|
33
|
+
switch (command.command) {
|
|
34
|
+
case 'sources': {
|
|
35
|
+
const result = await client.sources(pagination);
|
|
36
|
+
console.log(options.json
|
|
37
|
+
? JSON.stringify(result)
|
|
38
|
+
: result.sources
|
|
39
|
+
.map((source) => `${source.id}\t${source.title}\t${source.kind}${source.toolCount === undefined ? '' : `\t${source.toolCount} tools`}`)
|
|
40
|
+
.join('\n') || 'No capability sources available.');
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'search': {
|
|
44
|
+
const result = await client.search({ ...pagination, query: command.query });
|
|
45
|
+
const rows = result.items.map((tool) => `${tool.aliases.join(', ') || tool.name}\t${tool.description}\t${tool.invocable.mode}`);
|
|
46
|
+
console.log(options.json
|
|
47
|
+
? JSON.stringify(result)
|
|
48
|
+
: [
|
|
49
|
+
...rows,
|
|
50
|
+
`${result.total} matches${result.nextOffset === null ? '' : `; next page: --offset ${result.nextOffset}`}`,
|
|
51
|
+
].join('\n'));
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case 'describe': {
|
|
55
|
+
const result = await client.describe(command.path);
|
|
56
|
+
console.log(options.json
|
|
57
|
+
? JSON.stringify(result)
|
|
58
|
+
: result.found
|
|
59
|
+
? JSON.stringify(result.tool, null, 2)
|
|
60
|
+
: `Capability ${result.path} was not found.`);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const failure = error instanceof CloudClientError
|
|
68
|
+
? {
|
|
69
|
+
code: error.code,
|
|
70
|
+
message: error.message,
|
|
71
|
+
...(error.status === undefined ? {} : { status: error.status }),
|
|
72
|
+
}
|
|
73
|
+
: error instanceof ZodError
|
|
74
|
+
? {
|
|
75
|
+
code: 'invalid_input',
|
|
76
|
+
message: 'Check the query, capability path, and pagination (limit 1–100; offset 0 or greater).',
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
code: 'cloud_discovery_error',
|
|
80
|
+
message: 'Cloud discovery failed. Check the platform origin and credential configuration.',
|
|
81
|
+
};
|
|
82
|
+
if (options.json)
|
|
83
|
+
console.log(JSON.stringify({ error: failure }));
|
|
84
|
+
else
|
|
85
|
+
console.error(failure.message);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cloud/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgC3D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { withAnalytics, safeExit } from '../../../analytics/wrapper.js';
|
|
2
|
+
async function discover(command, options) {
|
|
3
|
+
const { runCloudDiscovery } = await import('./discovery.js');
|
|
4
|
+
const exitCode = await runCloudDiscovery(command, options);
|
|
5
|
+
safeExit(`cloud ${command.command}`, exitCode);
|
|
6
|
+
}
|
|
7
|
+
export function registerCloudCommand(program) {
|
|
8
|
+
const cloud = program.command('cloud').description('Discover Dexto Cloud capabilities');
|
|
9
|
+
const sources = cloud.command('sources').description('List available capability sources');
|
|
10
|
+
const search = cloud.command('search <query>').description('Find capabilities by name or task');
|
|
11
|
+
const describe = cloud
|
|
12
|
+
.command('describe <path>')
|
|
13
|
+
.description('Show capability schemas and availability');
|
|
14
|
+
for (const command of [sources, search, describe]) {
|
|
15
|
+
command
|
|
16
|
+
.option('--json', 'Emit machine-readable JSON')
|
|
17
|
+
.option('--platform-url <origin>', 'Use a Cloud application origin');
|
|
18
|
+
}
|
|
19
|
+
for (const command of [sources, search]) {
|
|
20
|
+
command
|
|
21
|
+
.option('--limit <count>', 'Page size (1–100; default 20)')
|
|
22
|
+
.option('--offset <count>', 'Page offset (default 0)');
|
|
23
|
+
}
|
|
24
|
+
sources.action(withAnalytics('cloud sources', (options) => discover({ command: 'sources' }, options)));
|
|
25
|
+
search.action(withAnalytics('cloud search', (query, options) => discover({ command: 'search', query }, options)));
|
|
26
|
+
describe.action(withAnalytics('cloud describe', (path, options) => discover({ command: 'describe', path }, options)));
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/mcp/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/mcp/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAOjD,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE,yBAAyB,GAAG,IAAI,CAmZ/E"}
|