@dexto/agent-management 1.19.2 → 1.19.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.
- package/dist/auth/dexto-gateway.cjs +3 -2
- package/dist/auth/dexto-gateway.d.ts.map +1 -1
- package/dist/auth/dexto-gateway.js +3 -2
- package/dist/auth/dexto-sign-in.cjs +23 -0
- package/dist/auth/dexto-sign-in.d.ts +8 -0
- package/dist/auth/dexto-sign-in.d.ts.map +1 -1
- package/dist/auth/dexto-sign-in.js +22 -0
- package/package.json +5 -5
|
@@ -30,6 +30,7 @@ var import_core = require("@dexto/core");
|
|
|
30
30
|
var import_zod = require("zod");
|
|
31
31
|
var import_dexto_accounts = require("./dexto-accounts.js");
|
|
32
32
|
var import_dexto_sign_in = require("./dexto-sign-in.js");
|
|
33
|
+
const SPEND_SCOPE = "cloud:write";
|
|
33
34
|
const DEXTO_CLOUD_PROJECT_HEADER = "Dexto-Cloud-Project";
|
|
34
35
|
const SIGN_IN_PLACEHOLDER_KEY = "dexto-sign-in";
|
|
35
36
|
function defaultDextoGatewayOptions() {
|
|
@@ -70,7 +71,7 @@ function dextoGatewayRuntimeAuth(options) {
|
|
|
70
71
|
if (credential.kind === "oauth") {
|
|
71
72
|
if (!canSpend(credential.login))
|
|
72
73
|
throw new Error(
|
|
73
|
-
|
|
74
|
+
`Dexto models spend credits, which this sign-in may not do yet. Run dexto login --scope ${SPEND_SCOPE}.`
|
|
74
75
|
);
|
|
75
76
|
if (credential.login.cloudProject === null)
|
|
76
77
|
throw new Error(
|
|
@@ -143,7 +144,7 @@ async function currentCredential(options) {
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
function canSpend(login) {
|
|
146
|
-
return login.scopes.includes(
|
|
147
|
+
return login.scopes.includes(SPEND_SCOPE);
|
|
147
148
|
}
|
|
148
149
|
function rebase(url, from, to) {
|
|
149
150
|
return from === to || !url.startsWith(from) ? url : `${to}${url.slice(from.length)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexto-gateway.d.ts","sourceRoot":"","sources":["../../src/auth/dexto-gateway.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAqB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"dexto-gateway.d.ts","sourceRoot":"","sources":["../../src/auth/dexto-gateway.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAqB,MAAM,qBAAqB,CAAC;AAU1F,MAAM,WAAW,mBAAmB;IAChC,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnE,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,IAAI,mBAAmB,CAYhE;AAED,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GACtB;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACjC;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAClC;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAE3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
|
|
4
4
|
import { refreshSignIn } from "./dexto-sign-in.js";
|
|
5
|
+
const SPEND_SCOPE = "cloud:write";
|
|
5
6
|
const DEXTO_CLOUD_PROJECT_HEADER = "Dexto-Cloud-Project";
|
|
6
7
|
const SIGN_IN_PLACEHOLDER_KEY = "dexto-sign-in";
|
|
7
8
|
function defaultDextoGatewayOptions() {
|
|
@@ -42,7 +43,7 @@ function dextoGatewayRuntimeAuth(options) {
|
|
|
42
43
|
if (credential.kind === "oauth") {
|
|
43
44
|
if (!canSpend(credential.login))
|
|
44
45
|
throw new Error(
|
|
45
|
-
|
|
46
|
+
`Dexto models spend credits, which this sign-in may not do yet. Run dexto login --scope ${SPEND_SCOPE}.`
|
|
46
47
|
);
|
|
47
48
|
if (credential.login.cloudProject === null)
|
|
48
49
|
throw new Error(
|
|
@@ -115,7 +116,7 @@ async function currentCredential(options) {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
function canSpend(login) {
|
|
118
|
-
return login.scopes.includes(
|
|
119
|
+
return login.scopes.includes(SPEND_SCOPE);
|
|
119
120
|
}
|
|
120
121
|
function rebase(url, from, to) {
|
|
121
122
|
return from === to || !url.startsWith(from) ? url : `${to}${url.slice(from.length)}`;
|
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var dexto_sign_in_exports = {};
|
|
20
20
|
__export(dexto_sign_in_exports, {
|
|
21
|
+
CLI_LOGIN_SCOPES: () => CLI_LOGIN_SCOPES,
|
|
21
22
|
DEXTO_CLI_CLIENT_ID: () => DEXTO_CLI_CLIENT_ID,
|
|
22
23
|
OAuthHttpError: () => OAuthHttpError,
|
|
23
24
|
SignInEnded: () => SignInEnded,
|
|
@@ -32,6 +33,27 @@ var import_node_crypto = require("node:crypto");
|
|
|
32
33
|
var import_zod = require("zod");
|
|
33
34
|
var import_dexto_accounts = require("./dexto-accounts.js");
|
|
34
35
|
const DEXTO_CLI_CLIENT_ID = "dexto-cli";
|
|
36
|
+
const CLI_LOGIN_SCOPES = [
|
|
37
|
+
"apps:execute",
|
|
38
|
+
"apps:read",
|
|
39
|
+
"artifacts:read",
|
|
40
|
+
"artifacts:write",
|
|
41
|
+
"chats:sync",
|
|
42
|
+
"cloud:read",
|
|
43
|
+
"cloud:write",
|
|
44
|
+
"computers:read",
|
|
45
|
+
"computers:write",
|
|
46
|
+
"drive:read",
|
|
47
|
+
"drive:write",
|
|
48
|
+
"functions:read",
|
|
49
|
+
"functions:write",
|
|
50
|
+
"projects:read",
|
|
51
|
+
"projects:write",
|
|
52
|
+
"sessions:read",
|
|
53
|
+
"sessions:write",
|
|
54
|
+
"sites:read",
|
|
55
|
+
"sites:write"
|
|
56
|
+
];
|
|
35
57
|
const BASE_CLOUD_SCOPES = ["cloud:read"];
|
|
36
58
|
const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
37
59
|
const LOGIN_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -334,6 +356,7 @@ function expiresAt(expiresInSeconds) {
|
|
|
334
356
|
}
|
|
335
357
|
// Annotate the CommonJS export names for ESM import in node:
|
|
336
358
|
0 && (module.exports = {
|
|
359
|
+
CLI_LOGIN_SCOPES,
|
|
337
360
|
DEXTO_CLI_CLIENT_ID,
|
|
338
361
|
OAuthHttpError,
|
|
339
362
|
SignInEnded,
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { type OAuthLogin } from './dexto-accounts.js';
|
|
2
2
|
/** Dexto's pre-registered public client for this CLI: no secret, no registration. */
|
|
3
3
|
export declare const DEXTO_CLI_CLIENT_ID = "dexto-cli";
|
|
4
|
+
/**
|
|
5
|
+
* Every scope the Dexto CLI names itself: the base `cloud:read`, what its commands require before
|
|
6
|
+
* calling Cloud (and tell people to sign in again with), and Chat sync's `chats:sync`. Cloud's
|
|
7
|
+
* device and browser sign-in must accept each one; its drift test imports this list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CLI_LOGIN_SCOPES: readonly ["apps:execute", "apps:read", "artifacts:read", "artifacts:write", "chats:sync", "cloud:read", "cloud:write", "computers:read", "computers:write", "drive:read", "drive:write", "functions:read", "functions:write", "projects:read", "projects:write", "sessions:read", "sessions:write", "sites:read", "sites:write"];
|
|
10
|
+
/** A scope the CLI asks for by name. */
|
|
11
|
+
export type CliLoginScope = (typeof CLI_LOGIN_SCOPES)[number];
|
|
4
12
|
/** A loopback listener for the browser's redirect back to the CLI. */
|
|
5
13
|
export interface RedirectListener {
|
|
6
14
|
/** `http://127.0.0.1:<port>/callback`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexto-sign-in.d.ts","sourceRoot":"","sources":["../../src/auth/dexto-sign-in.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"dexto-sign-in.d.ts","sourceRoot":"","sources":["../../src/auth/dexto-sign-in.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,kUAoBnB,CAAC;AAEX,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAU9D,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED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AM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM;CAMnE"}
|
|
@@ -2,6 +2,27 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { SignedInAsSchema } from "./dexto-accounts.js";
|
|
4
4
|
const DEXTO_CLI_CLIENT_ID = "dexto-cli";
|
|
5
|
+
const CLI_LOGIN_SCOPES = [
|
|
6
|
+
"apps:execute",
|
|
7
|
+
"apps:read",
|
|
8
|
+
"artifacts:read",
|
|
9
|
+
"artifacts:write",
|
|
10
|
+
"chats:sync",
|
|
11
|
+
"cloud:read",
|
|
12
|
+
"cloud:write",
|
|
13
|
+
"computers:read",
|
|
14
|
+
"computers:write",
|
|
15
|
+
"drive:read",
|
|
16
|
+
"drive:write",
|
|
17
|
+
"functions:read",
|
|
18
|
+
"functions:write",
|
|
19
|
+
"projects:read",
|
|
20
|
+
"projects:write",
|
|
21
|
+
"sessions:read",
|
|
22
|
+
"sessions:write",
|
|
23
|
+
"sites:read",
|
|
24
|
+
"sites:write"
|
|
25
|
+
];
|
|
5
26
|
const BASE_CLOUD_SCOPES = ["cloud:read"];
|
|
6
27
|
const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
7
28
|
const LOGIN_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -303,6 +324,7 @@ function expiresAt(expiresInSeconds) {
|
|
|
303
324
|
return new Date(Date.now() + expiresInSeconds * 1e3).toISOString();
|
|
304
325
|
}
|
|
305
326
|
export {
|
|
327
|
+
CLI_LOGIN_SCOPES,
|
|
306
328
|
DEXTO_CLI_CLIENT_ID,
|
|
307
329
|
OAuthHttpError,
|
|
308
330
|
SignInEnded,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/agent-management",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"yaml": "^2.8.3",
|
|
24
24
|
"zod": "^4.3.6",
|
|
25
|
-
"@dexto/agent-config": "1.19.
|
|
26
|
-
"@dexto/core": "1.19.
|
|
27
|
-
"@dexto/llm": "1.19.
|
|
28
|
-
"@dexto/tools-builtins": "1.19.
|
|
25
|
+
"@dexto/agent-config": "1.19.4",
|
|
26
|
+
"@dexto/core": "1.19.4",
|
|
27
|
+
"@dexto/llm": "1.19.4",
|
|
28
|
+
"@dexto/tools-builtins": "1.19.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.13.5"
|