@dexto/agent-management 1.6.20 → 1.6.22
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/AgentFactory.cjs +12 -2
- package/dist/AgentFactory.d.ts.map +1 -1
- package/dist/AgentFactory.js +14 -8
- package/dist/preferences/loader.cjs +1 -1
- package/dist/preferences/loader.js +1 -1
- package/dist/project-registry.cjs +34 -0
- package/dist/project-registry.d.ts.map +1 -1
- package/dist/project-registry.js +34 -0
- package/dist/resolver.cjs +22 -16
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +22 -16
- package/dist/utils/dexto-auth.cjs +29 -21
- package/dist/utils/dexto-auth.d.ts +2 -2
- package/dist/utils/dexto-auth.d.ts.map +1 -1
- package/dist/utils/dexto-auth.js +29 -21
- package/package.json +5 -5
package/dist/AgentFactory.cjs
CHANGED
|
@@ -72,7 +72,17 @@ const AgentFactory = {
|
|
|
72
72
|
* Install a custom agent from local path
|
|
73
73
|
*/
|
|
74
74
|
async installCustomAgent(agentId, sourcePath, metadata, options) {
|
|
75
|
-
|
|
75
|
+
if (options?.agentsDir) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
"Custom agentsDir overrides are not supported by AgentFactory.installCustomAgent"
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return (0, import_registry.getAgentRegistry)().installCustomAgentFromPath(agentId, sourcePath, {
|
|
81
|
+
name: metadata.name,
|
|
82
|
+
description: metadata.description,
|
|
83
|
+
author: metadata.author || "Custom",
|
|
84
|
+
tags: metadata.tags ?? []
|
|
85
|
+
});
|
|
76
86
|
},
|
|
77
87
|
/**
|
|
78
88
|
* Uninstall an agent
|
|
@@ -80,7 +90,7 @@ const AgentFactory = {
|
|
|
80
90
|
* @param _force - Deprecated: force parameter is kept for backward compatibility but has no effect
|
|
81
91
|
*/
|
|
82
92
|
async uninstallAgent(agentId, _force) {
|
|
83
|
-
return (0,
|
|
93
|
+
return (0, import_registry.getAgentRegistry)().uninstallAgent(agentId, _force);
|
|
84
94
|
},
|
|
85
95
|
/**
|
|
86
96
|
* Create an agent from an inline configuration object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentFactory.d.ts","sourceRoot":"","sources":["../src/AgentFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIrE,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentFactory.d.ts","sourceRoot":"","sources":["../src/AgentFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIrE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,6CAA6C;IAC7C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6CAA6C;IAC7C,8BAA8B,CAAC,EAAE,MAAM,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC;CAC9E;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY;IACrB;;;OAGG;yBACwB,iBAAiB;;;;;;;;;;;;;;;;;;IAyC5C;;OAEG;0BACyB,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAI9E;;OAEG;gCAEU,MAAM,cACH,MAAM,YACR,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC,YAC/D,cAAc,GACzB,OAAO,CAAC,MAAM,CAAC;IAelB;;;;OAIG;4BAC2B,MAAM,WAAW,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;wBACuB,WAAW,YAAY,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;CAoB5F,CAAC"}
|
package/dist/AgentFactory.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { promises as fs } from "fs";
|
|
2
2
|
import { getDextoGlobalPath } from "./utils/path.js";
|
|
3
3
|
import { deriveDisplayName } from "./registry/types.js";
|
|
4
|
-
import { loadBundledRegistryAgents } from "./registry/registry.js";
|
|
5
|
-
import {
|
|
6
|
-
installBundledAgent,
|
|
7
|
-
installCustomAgent,
|
|
8
|
-
uninstallAgent
|
|
9
|
-
} from "./installation.js";
|
|
4
|
+
import { getAgentRegistry, loadBundledRegistryAgents } from "./registry/registry.js";
|
|
5
|
+
import { installBundledAgent } from "./installation.js";
|
|
10
6
|
import { createDextoAgentFromConfig } from "./agent-creation.js";
|
|
11
7
|
const AgentFactory = {
|
|
12
8
|
/**
|
|
@@ -53,7 +49,17 @@ const AgentFactory = {
|
|
|
53
49
|
* Install a custom agent from local path
|
|
54
50
|
*/
|
|
55
51
|
async installCustomAgent(agentId, sourcePath, metadata, options) {
|
|
56
|
-
|
|
52
|
+
if (options?.agentsDir) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"Custom agentsDir overrides are not supported by AgentFactory.installCustomAgent"
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return getAgentRegistry().installCustomAgentFromPath(agentId, sourcePath, {
|
|
58
|
+
name: metadata.name,
|
|
59
|
+
description: metadata.description,
|
|
60
|
+
author: metadata.author || "Custom",
|
|
61
|
+
tags: metadata.tags ?? []
|
|
62
|
+
});
|
|
57
63
|
},
|
|
58
64
|
/**
|
|
59
65
|
* Uninstall an agent
|
|
@@ -61,7 +67,7 @@ const AgentFactory = {
|
|
|
61
67
|
* @param _force - Deprecated: force parameter is kept for backward compatibility but has no effect
|
|
62
68
|
*/
|
|
63
69
|
async uninstallAgent(agentId, _force) {
|
|
64
|
-
return uninstallAgent(agentId);
|
|
70
|
+
return getAgentRegistry().uninstallAgent(agentId, _force);
|
|
65
71
|
},
|
|
66
72
|
/**
|
|
67
73
|
* Create an agent from an inline configuration object
|
|
@@ -240,7 +240,7 @@ function createInitialPreferences(options) {
|
|
|
240
240
|
llm: llmConfig,
|
|
241
241
|
defaults: {
|
|
242
242
|
defaultAgent: options.defaultAgent || "coding-agent",
|
|
243
|
-
defaultMode: options.defaultMode || "
|
|
243
|
+
defaultMode: options.defaultMode || "cli"
|
|
244
244
|
},
|
|
245
245
|
setup: {
|
|
246
246
|
completed: options.setupCompleted ?? true,
|
|
@@ -200,7 +200,7 @@ function createInitialPreferences(options) {
|
|
|
200
200
|
llm: llmConfig,
|
|
201
201
|
defaults: {
|
|
202
202
|
defaultAgent: options.defaultAgent || "coding-agent",
|
|
203
|
-
defaultMode: options.defaultMode || "
|
|
203
|
+
defaultMode: options.defaultMode || "cli"
|
|
204
204
|
},
|
|
205
205
|
setup: {
|
|
206
206
|
completed: options.setupCompleted ?? true,
|
|
@@ -133,6 +133,34 @@ const PROJECT_REGISTRY_RELATIVE_PATHS = [
|
|
|
133
133
|
import_path.default.join("agents", "registry.json"),
|
|
134
134
|
import_path.default.join("agents", "agent-registry.json")
|
|
135
135
|
];
|
|
136
|
+
function isBundledAgentRegistryShape(parsed) {
|
|
137
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
const candidate = parsed;
|
|
141
|
+
return typeof candidate.version === "string" && candidate.agents !== null && typeof candidate.agents === "object" && !Array.isArray(candidate.agents);
|
|
142
|
+
}
|
|
143
|
+
async function shouldIgnoreProjectRegistryCandidate(registryPath) {
|
|
144
|
+
if (import_path.default.basename(registryPath) !== "agent-registry.json") {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const content = await import_fs2.promises.readFile(registryPath, "utf-8");
|
|
149
|
+
return isBundledAgentRegistryShape(JSON.parse(content));
|
|
150
|
+
} catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function shouldIgnoreProjectRegistryCandidateSync(registryPath) {
|
|
155
|
+
if (import_path.default.basename(registryPath) !== "agent-registry.json") {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
return isBundledAgentRegistryShape(JSON.parse((0, import_fs.readFileSync)(registryPath, "utf-8")));
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
136
164
|
function getProjectRegistryPath(projectRoot) {
|
|
137
165
|
return import_path.default.join(projectRoot, "agents", "registry.json");
|
|
138
166
|
}
|
|
@@ -145,6 +173,9 @@ async function findProjectRegistryPath(projectRoot) {
|
|
|
145
173
|
for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
|
|
146
174
|
try {
|
|
147
175
|
if ((await import_fs2.promises.stat(registryPath)).isFile()) {
|
|
176
|
+
if (await shouldIgnoreProjectRegistryCandidate(registryPath)) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
148
179
|
return registryPath;
|
|
149
180
|
}
|
|
150
181
|
} catch (error) {
|
|
@@ -160,6 +191,9 @@ function findProjectRegistryPathSync(projectRoot) {
|
|
|
160
191
|
for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
|
|
161
192
|
try {
|
|
162
193
|
if ((0, import_fs.existsSync)(registryPath) && (0, import_fs.statSync)(registryPath).isFile()) {
|
|
194
|
+
if (shouldIgnoreProjectRegistryCandidateSync(registryPath)) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
163
197
|
return registryPath;
|
|
164
198
|
}
|
|
165
199
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-registry.d.ts","sourceRoot":"","sources":["../src/project-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC5B,CAAC;AAEP,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAC9B,0BAA0B,GAC1B,kCAAkC,GAClC,sCAAsC,CAAC;AAE7C,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE5B,OAAO,EAAE;QACjB,IAAI,EAAE,wBAAwB,CAAC;QAC/B,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,KAAK,CAA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M,GACpB,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG,IAAI,CAAC,CAUrE;AAED,wBAAgB,uBAAuB,CACnC,WAAW,EAAE,MAAM,GACpB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG,IAAI,CAU5D;AAED,wBAAsB,2BAA2B,CAC7C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAA;CAAE,GAAG,IAAI,CAAC,CAevE;AAED,wBAAgB,8BAA8B,CAC1C,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,MAAM,GACrB,oBAAoB,GAAG,IAAI,CAc7B;AAgGD,wBAAsB,qCAAqC,CACvD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,yCAAyC,CACrD,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,oBAAoB,GAC5B,MAAM,CAER;AAED,wBAAsB,+BAA+B,CACjD,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAED,wBAAsB,sCAAsC,CACxD,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYxB"}
|
package/dist/project-registry.js
CHANGED
|
@@ -83,6 +83,34 @@ const PROJECT_REGISTRY_RELATIVE_PATHS = [
|
|
|
83
83
|
path.join("agents", "registry.json"),
|
|
84
84
|
path.join("agents", "agent-registry.json")
|
|
85
85
|
];
|
|
86
|
+
function isBundledAgentRegistryShape(parsed) {
|
|
87
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const candidate = parsed;
|
|
91
|
+
return typeof candidate.version === "string" && candidate.agents !== null && typeof candidate.agents === "object" && !Array.isArray(candidate.agents);
|
|
92
|
+
}
|
|
93
|
+
async function shouldIgnoreProjectRegistryCandidate(registryPath) {
|
|
94
|
+
if (path.basename(registryPath) !== "agent-registry.json") {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const content = await fs.readFile(registryPath, "utf-8");
|
|
99
|
+
return isBundledAgentRegistryShape(JSON.parse(content));
|
|
100
|
+
} catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function shouldIgnoreProjectRegistryCandidateSync(registryPath) {
|
|
105
|
+
if (path.basename(registryPath) !== "agent-registry.json") {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
return isBundledAgentRegistryShape(JSON.parse(readFileSync(registryPath, "utf-8")));
|
|
110
|
+
} catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
86
114
|
function getProjectRegistryPath(projectRoot) {
|
|
87
115
|
return path.join(projectRoot, "agents", "registry.json");
|
|
88
116
|
}
|
|
@@ -95,6 +123,9 @@ async function findProjectRegistryPath(projectRoot) {
|
|
|
95
123
|
for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
|
|
96
124
|
try {
|
|
97
125
|
if ((await fs.stat(registryPath)).isFile()) {
|
|
126
|
+
if (await shouldIgnoreProjectRegistryCandidate(registryPath)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
98
129
|
return registryPath;
|
|
99
130
|
}
|
|
100
131
|
} catch (error) {
|
|
@@ -110,6 +141,9 @@ function findProjectRegistryPathSync(projectRoot) {
|
|
|
110
141
|
for (const registryPath of getProjectRegistryCandidatePaths(projectRoot)) {
|
|
111
142
|
try {
|
|
112
143
|
if (existsSync(registryPath) && statSync(registryPath).isFile()) {
|
|
144
|
+
if (shouldIgnoreProjectRegistryCandidateSync(registryPath)) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
113
147
|
return registryPath;
|
|
114
148
|
}
|
|
115
149
|
} catch (error) {
|
package/dist/resolver.cjs
CHANGED
|
@@ -187,27 +187,33 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
import_core.logger.debug(`No project-local coding-agent found in ${projectRoot}`);
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
if ((0, import_loader.globalPreferencesExist)()) {
|
|
191
|
+
try {
|
|
192
|
+
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
193
|
+
if (preferences.setup.completed && preferences.defaults.defaultAgent) {
|
|
194
|
+
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
195
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
196
|
+
}
|
|
197
|
+
} catch (error) {
|
|
198
|
+
import_core.logger.debug(`Could not load global preferences for project fallback: ${error}`);
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
|
-
|
|
198
|
-
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
201
|
+
return await resolveAgentByName("coding-agent", autoInstall);
|
|
199
202
|
}
|
|
200
203
|
async function resolveDefaultAgentForGlobalCLI(autoInstall = true) {
|
|
201
204
|
import_core.logger.debug("Resolving default agent for global CLI context");
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
if ((0, import_loader.globalPreferencesExist)()) {
|
|
206
|
+
try {
|
|
207
|
+
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
208
|
+
if (preferences.setup.completed && preferences.defaults.defaultAgent) {
|
|
209
|
+
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
210
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
import_core.logger.debug(`Could not load global preferences for CLI fallback: ${error}`);
|
|
214
|
+
}
|
|
208
215
|
}
|
|
209
|
-
|
|
210
|
-
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
216
|
+
return await resolveAgentByName("coding-agent", autoInstall);
|
|
211
217
|
}
|
|
212
218
|
async function updateDefaultAgentPreference(agentName) {
|
|
213
219
|
const agentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAwCA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,GAAE,OAAc,GAC5B,OAAO,CAAC,MAAM,CAAC,CAuBjB;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAwCA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,GAAE,OAAc,GAC5B,OAAO,CAAC,MAAM,CAAC,CAuBjB;AA0ND;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BnF"}
|
package/dist/resolver.js
CHANGED
|
@@ -160,27 +160,33 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
logger.debug(`No project-local coding-agent found in ${projectRoot}`);
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
if (globalPreferencesExist()) {
|
|
164
|
+
try {
|
|
165
|
+
const preferences = await loadGlobalPreferences();
|
|
166
|
+
if (preferences.setup.completed && preferences.defaults.defaultAgent) {
|
|
167
|
+
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
168
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
logger.debug(`Could not load global preferences for project fallback: ${error}`);
|
|
172
|
+
}
|
|
169
173
|
}
|
|
170
|
-
|
|
171
|
-
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
174
|
+
return await resolveAgentByName("coding-agent", autoInstall);
|
|
172
175
|
}
|
|
173
176
|
async function resolveDefaultAgentForGlobalCLI(autoInstall = true) {
|
|
174
177
|
logger.debug("Resolving default agent for global CLI context");
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
if (globalPreferencesExist()) {
|
|
179
|
+
try {
|
|
180
|
+
const preferences = await loadGlobalPreferences();
|
|
181
|
+
if (preferences.setup.completed && preferences.defaults.defaultAgent) {
|
|
182
|
+
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
183
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
logger.debug(`Could not load global preferences for CLI fallback: ${error}`);
|
|
187
|
+
}
|
|
181
188
|
}
|
|
182
|
-
|
|
183
|
-
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
189
|
+
return await resolveAgentByName("coding-agent", autoInstall);
|
|
184
190
|
}
|
|
185
191
|
async function updateDefaultAgentPreference(agentName) {
|
|
186
192
|
const agentsDir = getDextoGlobalPath("agents");
|
|
@@ -28,45 +28,53 @@ var import_zod = require("zod");
|
|
|
28
28
|
var import_core = require("@dexto/core");
|
|
29
29
|
const AUTH_CONFIG_FILE = "auth.json";
|
|
30
30
|
const AuthConfigSchema = import_zod.z.object({
|
|
31
|
-
token: import_zod.z.string().min(1),
|
|
31
|
+
token: import_zod.z.string().min(1).optional(),
|
|
32
|
+
refreshToken: import_zod.z.string().optional(),
|
|
32
33
|
expiresAt: import_zod.z.number().optional(),
|
|
33
|
-
|
|
34
|
+
createdAt: import_zod.z.number().optional(),
|
|
35
|
+
dextoApiKey: import_zod.z.string().optional(),
|
|
36
|
+
dextoKeyId: import_zod.z.string().optional(),
|
|
37
|
+
dextoApiKeySource: import_zod.z.enum(["provisioned", "user-supplied"]).optional()
|
|
38
|
+
}).refine((data) => data.token || data.dextoApiKey, {
|
|
39
|
+
message: "Either token or dextoApiKey is required"
|
|
34
40
|
});
|
|
35
|
-
async function
|
|
41
|
+
async function loadAuthConfig() {
|
|
36
42
|
const authPath = (0, import_core.getDextoGlobalPath)("", AUTH_CONFIG_FILE);
|
|
37
43
|
if (!(0, import_fs.existsSync)(authPath)) {
|
|
38
|
-
return
|
|
44
|
+
return null;
|
|
39
45
|
}
|
|
40
46
|
try {
|
|
41
47
|
const content = await import_fs.promises.readFile(authPath, "utf-8");
|
|
42
48
|
const config = JSON.parse(content);
|
|
43
49
|
const validated = AuthConfigSchema.safeParse(config);
|
|
44
50
|
if (!validated.success) {
|
|
45
|
-
return
|
|
51
|
+
return null;
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const auth = validated.data;
|
|
54
|
+
if (auth.expiresAt && auth.expiresAt < Date.now()) {
|
|
55
|
+
if (!auth.refreshToken && !auth.dextoApiKey) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
|
-
return
|
|
59
|
+
return auth;
|
|
51
60
|
} catch {
|
|
52
|
-
return
|
|
61
|
+
return null;
|
|
53
62
|
}
|
|
54
63
|
}
|
|
64
|
+
async function isDextoAuthenticated() {
|
|
65
|
+
return await loadAuthConfig() !== null;
|
|
66
|
+
}
|
|
55
67
|
async function getDextoApiKeyFromAuth() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return null;
|
|
68
|
+
const auth = await loadAuthConfig();
|
|
69
|
+
if (auth?.dextoApiKey?.trim()) {
|
|
70
|
+
const apiKey = auth.dextoApiKey.trim();
|
|
71
|
+
process.env.DEXTO_API_KEY = apiKey;
|
|
72
|
+
return apiKey;
|
|
62
73
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const config = JSON.parse(content);
|
|
66
|
-
return config.dextoApiKey || null;
|
|
67
|
-
} catch {
|
|
68
|
-
return null;
|
|
74
|
+
if (process.env.DEXTO_API_KEY?.trim()) {
|
|
75
|
+
return process.env.DEXTO_API_KEY;
|
|
69
76
|
}
|
|
77
|
+
return null;
|
|
70
78
|
}
|
|
71
79
|
async function canUseDextoProvider() {
|
|
72
80
|
const authenticated = await isDextoAuthenticated();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* Check if user is authenticated with Dexto.
|
|
9
|
-
* Returns true
|
|
9
|
+
* Returns true when auth.json contains usable Dexto auth state.
|
|
10
10
|
*/
|
|
11
11
|
export declare function isDextoAuthenticated(): Promise<boolean>;
|
|
12
12
|
/**
|
|
@@ -16,7 +16,7 @@ export declare function getDextoApiKeyFromAuth(): Promise<string | null>;
|
|
|
16
16
|
/**
|
|
17
17
|
* Check if user can use Dexto provider.
|
|
18
18
|
* Requires BOTH:
|
|
19
|
-
* 1. User
|
|
19
|
+
* 1. User has usable Dexto auth state (token, refresh-backed login, or stored API key)
|
|
20
20
|
* 2. Has DEXTO_API_KEY (from auth config or environment)
|
|
21
21
|
*/
|
|
22
22
|
export declare function canUseDextoProvider(): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexto-auth.d.ts","sourceRoot":"","sources":["../../src/utils/dexto-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"dexto-auth.d.ts","sourceRoot":"","sources":["../../src/utils/dexto-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4DH;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAE7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAarE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
|
package/dist/utils/dexto-auth.js
CHANGED
|
@@ -3,45 +3,53 @@ import { z } from "zod";
|
|
|
3
3
|
import { getDextoGlobalPath } from "@dexto/core";
|
|
4
4
|
const AUTH_CONFIG_FILE = "auth.json";
|
|
5
5
|
const AuthConfigSchema = z.object({
|
|
6
|
-
token: z.string().min(1),
|
|
6
|
+
token: z.string().min(1).optional(),
|
|
7
|
+
refreshToken: z.string().optional(),
|
|
7
8
|
expiresAt: z.number().optional(),
|
|
8
|
-
|
|
9
|
+
createdAt: z.number().optional(),
|
|
10
|
+
dextoApiKey: z.string().optional(),
|
|
11
|
+
dextoKeyId: z.string().optional(),
|
|
12
|
+
dextoApiKeySource: z.enum(["provisioned", "user-supplied"]).optional()
|
|
13
|
+
}).refine((data) => data.token || data.dextoApiKey, {
|
|
14
|
+
message: "Either token or dextoApiKey is required"
|
|
9
15
|
});
|
|
10
|
-
async function
|
|
16
|
+
async function loadAuthConfig() {
|
|
11
17
|
const authPath = getDextoGlobalPath("", AUTH_CONFIG_FILE);
|
|
12
18
|
if (!existsSync(authPath)) {
|
|
13
|
-
return
|
|
19
|
+
return null;
|
|
14
20
|
}
|
|
15
21
|
try {
|
|
16
22
|
const content = await fs.readFile(authPath, "utf-8");
|
|
17
23
|
const config = JSON.parse(content);
|
|
18
24
|
const validated = AuthConfigSchema.safeParse(config);
|
|
19
25
|
if (!validated.success) {
|
|
20
|
-
return
|
|
26
|
+
return null;
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
const auth = validated.data;
|
|
29
|
+
if (auth.expiresAt && auth.expiresAt < Date.now()) {
|
|
30
|
+
if (!auth.refreshToken && !auth.dextoApiKey) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
|
-
return
|
|
34
|
+
return auth;
|
|
26
35
|
} catch {
|
|
27
|
-
return
|
|
36
|
+
return null;
|
|
28
37
|
}
|
|
29
38
|
}
|
|
39
|
+
async function isDextoAuthenticated() {
|
|
40
|
+
return await loadAuthConfig() !== null;
|
|
41
|
+
}
|
|
30
42
|
async function getDextoApiKeyFromAuth() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return null;
|
|
43
|
+
const auth = await loadAuthConfig();
|
|
44
|
+
if (auth?.dextoApiKey?.trim()) {
|
|
45
|
+
const apiKey = auth.dextoApiKey.trim();
|
|
46
|
+
process.env.DEXTO_API_KEY = apiKey;
|
|
47
|
+
return apiKey;
|
|
37
48
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const config = JSON.parse(content);
|
|
41
|
-
return config.dextoApiKey || null;
|
|
42
|
-
} catch {
|
|
43
|
-
return null;
|
|
49
|
+
if (process.env.DEXTO_API_KEY?.trim()) {
|
|
50
|
+
return process.env.DEXTO_API_KEY;
|
|
44
51
|
}
|
|
52
|
+
return null;
|
|
45
53
|
}
|
|
46
54
|
async function canUseDextoProvider() {
|
|
47
55
|
const authenticated = await isDextoAuthenticated();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/agent-management",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.22",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"yaml": "^2.8.3",
|
|
19
19
|
"zod": "^3.25.0",
|
|
20
|
-
"@dexto/agent-config": "1.6.
|
|
21
|
-
"@dexto/core": "1.6.
|
|
22
|
-
"@dexto/orchestration": "1.6.
|
|
23
|
-
"@dexto/tools-builtins": "1.6.
|
|
20
|
+
"@dexto/agent-config": "1.6.22",
|
|
21
|
+
"@dexto/core": "1.6.22",
|
|
22
|
+
"@dexto/orchestration": "1.6.22",
|
|
23
|
+
"@dexto/tools-builtins": "1.6.22"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^22.13.5"
|