@dexto/agent-management 1.4.0 → 1.5.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/AgentFactory.cjs +1 -2
- package/dist/AgentFactory.d.ts +1 -1
- package/dist/AgentFactory.d.ts.map +1 -1
- package/dist/AgentFactory.js +1 -2
- package/dist/config/config-enrichment.cjs +50 -1
- package/dist/config/config-enrichment.d.ts +2 -2
- package/dist/config/config-enrichment.d.ts.map +1 -1
- package/dist/config/config-enrichment.js +51 -3
- package/dist/config/discover-prompts.cjs +13 -0
- package/dist/config/discover-prompts.d.ts +13 -0
- package/dist/config/discover-prompts.d.ts.map +1 -1
- package/dist/config/discover-prompts.js +12 -0
- package/dist/config/errors.cjs +2 -2
- package/dist/config/errors.js +2 -2
- package/dist/index.cjs +69 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +72 -2
- package/dist/installation.cjs +0 -13
- package/dist/installation.d.ts +0 -2
- package/dist/installation.d.ts.map +1 -1
- package/dist/installation.js +0 -13
- package/dist/models/custom-models.cjs +46 -2
- package/dist/models/custom-models.d.ts +54 -6
- package/dist/models/custom-models.d.ts.map +1 -1
- package/dist/models/custom-models.js +45 -2
- package/dist/models/index.cjs +89 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +68 -0
- package/dist/models/path-resolver.cjs +154 -0
- package/dist/models/path-resolver.d.ts +77 -0
- package/dist/models/path-resolver.d.ts.map +1 -0
- package/dist/models/path-resolver.js +108 -0
- package/dist/models/state-manager.cjs +220 -0
- package/dist/models/state-manager.d.ts +138 -0
- package/dist/models/state-manager.d.ts.map +1 -0
- package/dist/models/state-manager.js +184 -0
- package/dist/preferences/error-codes.cjs +2 -0
- package/dist/preferences/error-codes.d.ts +3 -1
- package/dist/preferences/error-codes.d.ts.map +1 -1
- package/dist/preferences/error-codes.js +2 -0
- package/dist/preferences/index.d.ts +1 -1
- package/dist/preferences/index.d.ts.map +1 -1
- package/dist/preferences/loader.cjs +35 -6
- package/dist/preferences/loader.d.ts +25 -4
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +35 -6
- package/dist/preferences/schemas.cjs +24 -3
- package/dist/preferences/schemas.d.ts +64 -24
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +31 -4
- package/dist/registry/registry.cjs +7 -43
- package/dist/registry/registry.d.ts +3 -6
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +7 -43
- package/dist/registry/types.d.ts +2 -4
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/resolver.cjs +20 -20
- package/dist/resolver.d.ts +1 -2
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +20 -20
- package/dist/utils/api-key-resolver.cjs +19 -1
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +19 -1
- package/dist/utils/api-key-store.cjs +46 -0
- package/dist/utils/api-key-store.d.ts +27 -0
- package/dist/utils/api-key-store.d.ts.map +1 -1
- package/dist/utils/api-key-store.js +44 -0
- package/dist/utils/env-file.cjs +20 -68
- package/dist/utils/env-file.d.ts +2 -1
- package/dist/utils/env-file.d.ts.map +1 -1
- package/dist/utils/env-file.js +20 -68
- package/dist/writer.cjs +20 -2
- package/dist/writer.d.ts +1 -0
- package/dist/writer.d.ts.map +1 -1
- package/dist/writer.js +20 -2
- package/package.json +2 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isValidProviderModel,
|
|
4
|
+
getSupportedModels,
|
|
5
|
+
acceptsAnyModel,
|
|
6
|
+
supportsCustomModels,
|
|
7
|
+
supportsBaseURL
|
|
8
|
+
} from "@dexto/core";
|
|
3
9
|
import { LLM_PROVIDERS } from "@dexto/core";
|
|
4
10
|
import { NonEmptyTrimmed } from "@dexto/core";
|
|
5
11
|
import { PreferenceErrorCode } from "./error-codes.js";
|
|
@@ -10,9 +16,16 @@ const PreferenceLLMSchema = z.object({
|
|
|
10
16
|
apiKey: z.string().regex(
|
|
11
17
|
/^\$[A-Z_][A-Z0-9_]*$/,
|
|
12
18
|
"Must be environment variable reference (e.g., $OPENAI_API_KEY)"
|
|
13
|
-
).describe(
|
|
19
|
+
).optional().describe(
|
|
20
|
+
"Environment variable reference for API key (optional for local providers like Ollama)"
|
|
21
|
+
),
|
|
22
|
+
baseURL: z.string().url("Must be a valid URL (e.g., http://localhost:11434/v1)").optional().describe("Custom base URL for providers that support it (openai-compatible, litellm)"),
|
|
23
|
+
reasoningEffort: z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional().describe(
|
|
24
|
+
"Reasoning effort level for OpenAI reasoning models (o1, o3, codex, gpt-5.x). Auto-detected if not set."
|
|
25
|
+
)
|
|
14
26
|
}).strict().superRefine((data, ctx) => {
|
|
15
|
-
|
|
27
|
+
const skipModelValidation = acceptsAnyModel(data.provider) || supportsCustomModels(data.provider);
|
|
28
|
+
if (!skipModelValidation && !isValidProviderModel(data.provider, data.model)) {
|
|
16
29
|
const supportedModels = getSupportedModels(data.provider);
|
|
17
30
|
ctx.addIssue({
|
|
18
31
|
code: z.ZodIssueCode.custom,
|
|
@@ -25,13 +38,27 @@ const PreferenceLLMSchema = z.object({
|
|
|
25
38
|
}
|
|
26
39
|
});
|
|
27
40
|
}
|
|
41
|
+
if (data.baseURL && !supportsBaseURL(data.provider)) {
|
|
42
|
+
ctx.addIssue({
|
|
43
|
+
code: z.ZodIssueCode.custom,
|
|
44
|
+
path: ["baseURL"],
|
|
45
|
+
message: `Provider '${data.provider}' does not support custom baseURL. Use 'openai-compatible' for custom endpoints.`,
|
|
46
|
+
params: {
|
|
47
|
+
code: PreferenceErrorCode.INVALID_PREFERENCE_VALUE,
|
|
48
|
+
scope: "preference",
|
|
49
|
+
type: ErrorType.USER
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
28
53
|
});
|
|
29
54
|
const PreferenceDefaultsSchema = z.object({
|
|
30
55
|
defaultAgent: z.string().min(1).describe("Default agent name for global CLI usage (required)"),
|
|
31
56
|
defaultMode: z.enum(["cli", "web", "server", "discord", "telegram", "mcp"]).default("web").describe("Default run mode when --mode flag is not specified (default: web)")
|
|
32
57
|
}).strict();
|
|
33
58
|
const PreferenceSetupSchema = z.object({
|
|
34
|
-
completed: z.boolean().default(false).describe("Whether initial setup has been completed")
|
|
59
|
+
completed: z.boolean().default(false).describe("Whether initial setup has been completed"),
|
|
60
|
+
apiKeyPending: z.boolean().default(false).describe("Whether API key setup was skipped and needs to be configured later"),
|
|
61
|
+
baseURLPending: z.boolean().default(false).describe("Whether baseURL setup was skipped and needs to be configured later")
|
|
35
62
|
}).strict();
|
|
36
63
|
const GlobalPreferencesSchema = z.object({
|
|
37
64
|
llm: PreferenceLLMSchema.describe("LLM configuration preferences"),
|
|
@@ -38,11 +38,10 @@ var import_fs2 = require("fs");
|
|
|
38
38
|
var import_path = __toESM(require("path"), 1);
|
|
39
39
|
var import_core = require("@dexto/core");
|
|
40
40
|
var import_path2 = require("../utils/path.js");
|
|
41
|
-
var import_loader = require("../preferences/loader.js");
|
|
42
|
-
var import_writer = require("../writer.js");
|
|
43
41
|
var import_types = require("./types.js");
|
|
44
42
|
var import_errors = require("./errors.js");
|
|
45
43
|
var import_user_registry = require("./user-registry.js");
|
|
44
|
+
var import_loader = require("../preferences/loader.js");
|
|
46
45
|
let cachedRegistry = null;
|
|
47
46
|
class LocalAgentRegistry {
|
|
48
47
|
_registry = null;
|
|
@@ -175,9 +174,8 @@ class LocalAgentRegistry {
|
|
|
175
174
|
/**
|
|
176
175
|
* Install agent atomically using temp + rename pattern
|
|
177
176
|
* @param agentId ID of the agent to install
|
|
178
|
-
* @param injectPreferences Whether to inject global preferences into installed agent (default: true)
|
|
179
177
|
*/
|
|
180
|
-
async installAgent(agentId
|
|
178
|
+
async installAgent(agentId) {
|
|
181
179
|
import_core.logger.info(`Installing agent: ${agentId}`);
|
|
182
180
|
const registry = this.getRegistry();
|
|
183
181
|
const agentData = registry.agents[agentId];
|
|
@@ -215,24 +213,6 @@ class LocalAgentRegistry {
|
|
|
215
213
|
}
|
|
216
214
|
await import_fs2.promises.rename(tempDir, targetDir);
|
|
217
215
|
import_core.logger.info(`\u2713 Installed agent '${agentId}' to ${targetDir}`);
|
|
218
|
-
if (injectPreferences) {
|
|
219
|
-
try {
|
|
220
|
-
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
221
|
-
await (0, import_writer.writePreferencesToAgent)(targetDir, preferences);
|
|
222
|
-
import_core.logger.info(`\u2713 Applied global preferences to installed agent '${agentId}'`);
|
|
223
|
-
} catch (error) {
|
|
224
|
-
import_core.logger.warn(
|
|
225
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
226
|
-
);
|
|
227
|
-
console.log(
|
|
228
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use bundled settings`
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
} else {
|
|
232
|
-
import_core.logger.info(
|
|
233
|
-
`Skipped preference injection for '${agentId}' (injectPreferences=false)`
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
216
|
return this.resolveMainConfig(targetDir, agentId);
|
|
237
217
|
} catch (error) {
|
|
238
218
|
try {
|
|
@@ -255,10 +235,9 @@ class LocalAgentRegistry {
|
|
|
255
235
|
* @param agentId Unique identifier for the custom agent
|
|
256
236
|
* @param sourcePath Absolute path to agent YAML file or directory
|
|
257
237
|
* @param metadata Agent metadata (name for display, description, author, tags, main)
|
|
258
|
-
* @param injectPreferences Whether to inject global preferences (default: true)
|
|
259
238
|
* @returns Path to the installed agent's main config file
|
|
260
239
|
*/
|
|
261
|
-
async installCustomAgentFromPath(agentId, sourcePath, metadata
|
|
240
|
+
async installCustomAgentFromPath(agentId, sourcePath, metadata) {
|
|
262
241
|
import_core.logger.info(`Installing custom agent '${agentId}' from ${sourcePath}`);
|
|
263
242
|
this.validateCustomAgentId(agentId);
|
|
264
243
|
if (!(0, import_fs.existsSync)(sourcePath)) {
|
|
@@ -332,20 +311,6 @@ class LocalAgentRegistry {
|
|
|
332
311
|
}
|
|
333
312
|
throw registryError;
|
|
334
313
|
}
|
|
335
|
-
if (injectPreferences) {
|
|
336
|
-
try {
|
|
337
|
-
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
338
|
-
await (0, import_writer.writePreferencesToAgent)(targetDir, preferences);
|
|
339
|
-
import_core.logger.info(`\u2713 Applied global preferences to custom agent '${agentId}'`);
|
|
340
|
-
} catch (error) {
|
|
341
|
-
import_core.logger.warn(
|
|
342
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
343
|
-
);
|
|
344
|
-
console.log(
|
|
345
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use default settings`
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
314
|
return mainConfigPath;
|
|
350
315
|
} catch (error) {
|
|
351
316
|
try {
|
|
@@ -369,9 +334,8 @@ class LocalAgentRegistry {
|
|
|
369
334
|
* Handles installing agent if needed
|
|
370
335
|
* @param agentId ID of the agent to resolve
|
|
371
336
|
* @param autoInstall Whether to automatically install missing agents from registry (default: true)
|
|
372
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
373
337
|
*/
|
|
374
|
-
async resolveAgent(agentId, autoInstall = true
|
|
338
|
+
async resolveAgent(agentId, autoInstall = true) {
|
|
375
339
|
import_core.logger.debug(`Resolving registry agent: ${agentId}`);
|
|
376
340
|
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
377
341
|
const installedPath = import_path.default.resolve(globalAgentsDir, agentId);
|
|
@@ -388,7 +352,7 @@ class LocalAgentRegistry {
|
|
|
388
352
|
if (this.hasAgent(agentId)) {
|
|
389
353
|
if (autoInstall) {
|
|
390
354
|
import_core.logger.info(`Installing agent '${agentId}' from registry...`);
|
|
391
|
-
return await this.installAgent(agentId
|
|
355
|
+
return await this.installAgent(agentId);
|
|
392
356
|
} else {
|
|
393
357
|
const registry2 = this.getRegistry();
|
|
394
358
|
const available2 = Object.keys(registry2.agents);
|
|
@@ -424,8 +388,8 @@ class LocalAgentRegistry {
|
|
|
424
388
|
const defaultAgent = preferences.defaults.defaultAgent;
|
|
425
389
|
return agentId !== defaultAgent;
|
|
426
390
|
} catch {
|
|
427
|
-
import_core.logger.warn("Could not load preferences, using fallback protection for
|
|
428
|
-
return agentId !== "
|
|
391
|
+
import_core.logger.warn("Could not load preferences, using fallback protection for coding-agent");
|
|
392
|
+
return agentId !== "coding-agent";
|
|
429
393
|
}
|
|
430
394
|
}
|
|
431
395
|
/**
|
|
@@ -79,15 +79,13 @@ export declare class LocalAgentRegistry implements AgentRegistry {
|
|
|
79
79
|
/**
|
|
80
80
|
* Install agent atomically using temp + rename pattern
|
|
81
81
|
* @param agentId ID of the agent to install
|
|
82
|
-
* @param injectPreferences Whether to inject global preferences into installed agent (default: true)
|
|
83
82
|
*/
|
|
84
|
-
installAgent(agentId: string
|
|
83
|
+
installAgent(agentId: string): Promise<string>;
|
|
85
84
|
/**
|
|
86
85
|
* Install a custom agent from a local file path
|
|
87
86
|
* @param agentId Unique identifier for the custom agent
|
|
88
87
|
* @param sourcePath Absolute path to agent YAML file or directory
|
|
89
88
|
* @param metadata Agent metadata (name for display, description, author, tags, main)
|
|
90
|
-
* @param injectPreferences Whether to inject global preferences (default: true)
|
|
91
89
|
* @returns Path to the installed agent's main config file
|
|
92
90
|
*/
|
|
93
91
|
installCustomAgentFromPath(agentId: string, sourcePath: string, metadata: {
|
|
@@ -96,16 +94,15 @@ export declare class LocalAgentRegistry implements AgentRegistry {
|
|
|
96
94
|
author: string;
|
|
97
95
|
tags: string[];
|
|
98
96
|
main?: string;
|
|
99
|
-
}
|
|
97
|
+
}): Promise<string>;
|
|
100
98
|
/**
|
|
101
99
|
* Resolve a registry agent ID to a config path
|
|
102
100
|
* NOTE: Only handles registry IDs, not file paths (routing done in loadAgentConfig)
|
|
103
101
|
* Handles installing agent if needed
|
|
104
102
|
* @param agentId ID of the agent to resolve
|
|
105
103
|
* @param autoInstall Whether to automatically install missing agents from registry (default: true)
|
|
106
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
107
104
|
*/
|
|
108
|
-
resolveAgent(agentId: string, autoInstall?: boolean
|
|
105
|
+
resolveAgent(agentId: string, autoInstall?: boolean): Promise<string>;
|
|
109
106
|
/**
|
|
110
107
|
* Get list of currently installed agents
|
|
111
108
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,QAAQ,EAER,aAAa,EACb,kBAAkB,EAErB,MAAM,YAAY,CAAC;AAapB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACpD,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;IACH,WAAW,IAAI,QAAQ;IAOvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAyCpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKlC;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAKxD;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IA0C5D;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgFpD;;;;;;OAMG;IACG,0BAA0B,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,GACF,OAAO,CAAC,MAAM,CAAC;IAqJlB;;;;;;OAMG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAsCjF;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAsB7C;;OAEG;YACW,sBAAsB;IAYpC;;;;;;OAMG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA8C/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAKrD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAY9E"}
|
|
@@ -3,8 +3,6 @@ import { promises as fs } from "fs";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { logger } from "@dexto/core";
|
|
5
5
|
import { resolveBundledScript, getDextoGlobalPath, copyDirectory } from "../utils/path.js";
|
|
6
|
-
import { loadGlobalPreferences } from "../preferences/loader.js";
|
|
7
|
-
import { writePreferencesToAgent } from "../writer.js";
|
|
8
6
|
import {
|
|
9
7
|
RegistrySchema,
|
|
10
8
|
normalizeRegistryJson
|
|
@@ -16,6 +14,7 @@ import {
|
|
|
16
14
|
removeAgentFromUserRegistry,
|
|
17
15
|
addAgentToUserRegistry
|
|
18
16
|
} from "./user-registry.js";
|
|
17
|
+
import { loadGlobalPreferences } from "../preferences/loader.js";
|
|
19
18
|
let cachedRegistry = null;
|
|
20
19
|
class LocalAgentRegistry {
|
|
21
20
|
_registry = null;
|
|
@@ -148,9 +147,8 @@ class LocalAgentRegistry {
|
|
|
148
147
|
/**
|
|
149
148
|
* Install agent atomically using temp + rename pattern
|
|
150
149
|
* @param agentId ID of the agent to install
|
|
151
|
-
* @param injectPreferences Whether to inject global preferences into installed agent (default: true)
|
|
152
150
|
*/
|
|
153
|
-
async installAgent(agentId
|
|
151
|
+
async installAgent(agentId) {
|
|
154
152
|
logger.info(`Installing agent: ${agentId}`);
|
|
155
153
|
const registry = this.getRegistry();
|
|
156
154
|
const agentData = registry.agents[agentId];
|
|
@@ -188,24 +186,6 @@ class LocalAgentRegistry {
|
|
|
188
186
|
}
|
|
189
187
|
await fs.rename(tempDir, targetDir);
|
|
190
188
|
logger.info(`\u2713 Installed agent '${agentId}' to ${targetDir}`);
|
|
191
|
-
if (injectPreferences) {
|
|
192
|
-
try {
|
|
193
|
-
const preferences = await loadGlobalPreferences();
|
|
194
|
-
await writePreferencesToAgent(targetDir, preferences);
|
|
195
|
-
logger.info(`\u2713 Applied global preferences to installed agent '${agentId}'`);
|
|
196
|
-
} catch (error) {
|
|
197
|
-
logger.warn(
|
|
198
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
199
|
-
);
|
|
200
|
-
console.log(
|
|
201
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use bundled settings`
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
logger.info(
|
|
206
|
-
`Skipped preference injection for '${agentId}' (injectPreferences=false)`
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
189
|
return this.resolveMainConfig(targetDir, agentId);
|
|
210
190
|
} catch (error) {
|
|
211
191
|
try {
|
|
@@ -228,10 +208,9 @@ class LocalAgentRegistry {
|
|
|
228
208
|
* @param agentId Unique identifier for the custom agent
|
|
229
209
|
* @param sourcePath Absolute path to agent YAML file or directory
|
|
230
210
|
* @param metadata Agent metadata (name for display, description, author, tags, main)
|
|
231
|
-
* @param injectPreferences Whether to inject global preferences (default: true)
|
|
232
211
|
* @returns Path to the installed agent's main config file
|
|
233
212
|
*/
|
|
234
|
-
async installCustomAgentFromPath(agentId, sourcePath, metadata
|
|
213
|
+
async installCustomAgentFromPath(agentId, sourcePath, metadata) {
|
|
235
214
|
logger.info(`Installing custom agent '${agentId}' from ${sourcePath}`);
|
|
236
215
|
this.validateCustomAgentId(agentId);
|
|
237
216
|
if (!existsSync(sourcePath)) {
|
|
@@ -305,20 +284,6 @@ class LocalAgentRegistry {
|
|
|
305
284
|
}
|
|
306
285
|
throw registryError;
|
|
307
286
|
}
|
|
308
|
-
if (injectPreferences) {
|
|
309
|
-
try {
|
|
310
|
-
const preferences = await loadGlobalPreferences();
|
|
311
|
-
await writePreferencesToAgent(targetDir, preferences);
|
|
312
|
-
logger.info(`\u2713 Applied global preferences to custom agent '${agentId}'`);
|
|
313
|
-
} catch (error) {
|
|
314
|
-
logger.warn(
|
|
315
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
316
|
-
);
|
|
317
|
-
console.log(
|
|
318
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use default settings`
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
287
|
return mainConfigPath;
|
|
323
288
|
} catch (error) {
|
|
324
289
|
try {
|
|
@@ -342,9 +307,8 @@ class LocalAgentRegistry {
|
|
|
342
307
|
* Handles installing agent if needed
|
|
343
308
|
* @param agentId ID of the agent to resolve
|
|
344
309
|
* @param autoInstall Whether to automatically install missing agents from registry (default: true)
|
|
345
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
346
310
|
*/
|
|
347
|
-
async resolveAgent(agentId, autoInstall = true
|
|
311
|
+
async resolveAgent(agentId, autoInstall = true) {
|
|
348
312
|
logger.debug(`Resolving registry agent: ${agentId}`);
|
|
349
313
|
const globalAgentsDir = getDextoGlobalPath("agents");
|
|
350
314
|
const installedPath = path.resolve(globalAgentsDir, agentId);
|
|
@@ -361,7 +325,7 @@ class LocalAgentRegistry {
|
|
|
361
325
|
if (this.hasAgent(agentId)) {
|
|
362
326
|
if (autoInstall) {
|
|
363
327
|
logger.info(`Installing agent '${agentId}' from registry...`);
|
|
364
|
-
return await this.installAgent(agentId
|
|
328
|
+
return await this.installAgent(agentId);
|
|
365
329
|
} else {
|
|
366
330
|
const registry2 = this.getRegistry();
|
|
367
331
|
const available2 = Object.keys(registry2.agents);
|
|
@@ -397,8 +361,8 @@ class LocalAgentRegistry {
|
|
|
397
361
|
const defaultAgent = preferences.defaults.defaultAgent;
|
|
398
362
|
return agentId !== defaultAgent;
|
|
399
363
|
} catch {
|
|
400
|
-
logger.warn("Could not load preferences, using fallback protection for
|
|
401
|
-
return agentId !== "
|
|
364
|
+
logger.warn("Could not load preferences, using fallback protection for coding-agent");
|
|
365
|
+
return agentId !== "coding-agent";
|
|
402
366
|
}
|
|
403
367
|
}
|
|
404
368
|
/**
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -115,10 +115,9 @@ export interface AgentRegistry {
|
|
|
115
115
|
/**
|
|
116
116
|
* Installs an agent from the registry by ID
|
|
117
117
|
* @param agentId - Unique agent identifier
|
|
118
|
-
* @param injectPreferences - Whether to inject global preferences (default: true)
|
|
119
118
|
* @returns Path to the installed agent config
|
|
120
119
|
*/
|
|
121
|
-
installAgent(agentId: string
|
|
120
|
+
installAgent(agentId: string): Promise<string>;
|
|
122
121
|
/**
|
|
123
122
|
* Uninstalls an agent by ID
|
|
124
123
|
* @param agentId - Unique agent identifier
|
|
@@ -133,10 +132,9 @@ export interface AgentRegistry {
|
|
|
133
132
|
* Resolves an agent ID or path and optionally auto-installs if needed
|
|
134
133
|
* @param idOrPath - Agent ID from registry or filesystem path
|
|
135
134
|
* @param autoInstall - Whether to auto-install from registry (default: true)
|
|
136
|
-
* @param injectPreferences - Whether to inject preferences during install (default: true)
|
|
137
135
|
* @returns Path to the agent config file
|
|
138
136
|
*/
|
|
139
|
-
resolveAgent(idOrPath: string, autoInstall?: boolean
|
|
137
|
+
resolveAgent(idOrPath: string, autoInstall?: boolean): Promise<string>;
|
|
140
138
|
}
|
|
141
139
|
export {};
|
|
142
140
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKd,CAAC;AAEd,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvD,KAAK,WAAW,GAAG;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CAsC/D;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACzD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKd,CAAC;AAEd,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvD,KAAK,WAAW,GAAG;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CAsC/D;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACzD;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1E"}
|
package/dist/resolver.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var import_config = require("./config/index.js");
|
|
|
42
42
|
var import_errors = require("./registry/errors.js");
|
|
43
43
|
var import_AgentManager = require("./AgentManager.js");
|
|
44
44
|
var import_installation = require("./installation.js");
|
|
45
|
-
async function resolveAgentPath(nameOrPath, autoInstall = true
|
|
45
|
+
async function resolveAgentPath(nameOrPath, autoInstall = true) {
|
|
46
46
|
if (nameOrPath && (0, import_path2.isPath)(nameOrPath)) {
|
|
47
47
|
const resolved = import_path.default.resolve(nameOrPath);
|
|
48
48
|
try {
|
|
@@ -56,11 +56,11 @@ async function resolveAgentPath(nameOrPath, autoInstall = true, injectPreference
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (nameOrPath) {
|
|
59
|
-
return await resolveAgentByName(nameOrPath, autoInstall
|
|
59
|
+
return await resolveAgentByName(nameOrPath, autoInstall);
|
|
60
60
|
}
|
|
61
|
-
return await resolveDefaultAgentByContext(autoInstall
|
|
61
|
+
return await resolveDefaultAgentByContext(autoInstall);
|
|
62
62
|
}
|
|
63
|
-
async function resolveAgentByName(agentId, autoInstall
|
|
63
|
+
async function resolveAgentByName(agentId, autoInstall) {
|
|
64
64
|
const agentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
65
65
|
const installedRegistryPath = import_path.default.join(agentsDir, "registry.json");
|
|
66
66
|
try {
|
|
@@ -76,7 +76,7 @@ async function resolveAgentByName(agentId, autoInstall, injectPreferences) {
|
|
|
76
76
|
if (autoInstall) {
|
|
77
77
|
try {
|
|
78
78
|
import_core.logger.info(`Auto-installing agent '${agentId}' from bundled registry`);
|
|
79
|
-
const configPath = await (0, import_installation.installBundledAgent)(agentId
|
|
79
|
+
const configPath = await (0, import_installation.installBundledAgent)(agentId);
|
|
80
80
|
return configPath;
|
|
81
81
|
} catch (error) {
|
|
82
82
|
import_core.logger.debug(`Failed to auto-install agent '${agentId}': ${error}`);
|
|
@@ -97,26 +97,26 @@ async function getAgentConfigPath(agentId) {
|
|
|
97
97
|
}
|
|
98
98
|
return import_path.default.resolve(import_path.default.dirname(installedRegistryPath), agentEntry.configPath);
|
|
99
99
|
}
|
|
100
|
-
async function resolveDefaultAgentByContext(autoInstall = true
|
|
100
|
+
async function resolveDefaultAgentByContext(autoInstall = true) {
|
|
101
101
|
const executionContext = (0, import_execution_context.getExecutionContext)();
|
|
102
102
|
switch (executionContext) {
|
|
103
103
|
case "dexto-source":
|
|
104
|
-
return await resolveDefaultAgentForDextoSource(autoInstall
|
|
104
|
+
return await resolveDefaultAgentForDextoSource(autoInstall);
|
|
105
105
|
case "dexto-project":
|
|
106
|
-
return await resolveDefaultAgentForDextoProject(autoInstall
|
|
106
|
+
return await resolveDefaultAgentForDextoProject(autoInstall);
|
|
107
107
|
case "global-cli":
|
|
108
|
-
return await resolveDefaultAgentForGlobalCLI(autoInstall
|
|
108
|
+
return await resolveDefaultAgentForGlobalCLI(autoInstall);
|
|
109
109
|
default:
|
|
110
110
|
throw import_config.ConfigError.unknownContext(executionContext);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
async function resolveDefaultAgentForDextoSource(autoInstall = true
|
|
113
|
+
async function resolveDefaultAgentForDextoSource(autoInstall = true) {
|
|
114
114
|
import_core.logger.debug("Resolving default agent for dexto source context");
|
|
115
115
|
const sourceRoot = (0, import_execution_context.findDextoSourceRoot)();
|
|
116
116
|
if (!sourceRoot) {
|
|
117
117
|
throw import_config.ConfigError.bundledNotFound("dexto source directory not found");
|
|
118
118
|
}
|
|
119
|
-
const repoConfigPath = import_path.default.join(sourceRoot, "agents", "
|
|
119
|
+
const repoConfigPath = import_path.default.join(sourceRoot, "agents", "coding-agent", "coding-agent.yml");
|
|
120
120
|
const isDevMode = process.env.DEXTO_DEV_MODE === "true";
|
|
121
121
|
if (isDevMode) {
|
|
122
122
|
import_core.logger.debug("Dev mode: using repository config file");
|
|
@@ -133,7 +133,7 @@ async function resolveDefaultAgentForDextoSource(autoInstall = true, injectPrefe
|
|
|
133
133
|
if (preferences.setup.completed) {
|
|
134
134
|
import_core.logger.debug("Using user preferences in dexto-source context");
|
|
135
135
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
136
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
136
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
137
137
|
}
|
|
138
138
|
} catch (error) {
|
|
139
139
|
import_core.logger.warn(`Failed to load preferences, falling back to repo config: ${error}`);
|
|
@@ -147,16 +147,16 @@ async function resolveDefaultAgentForDextoSource(autoInstall = true, injectPrefe
|
|
|
147
147
|
throw import_config.ConfigError.bundledNotFound(repoConfigPath);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
async function resolveDefaultAgentForDextoProject(autoInstall = true
|
|
150
|
+
async function resolveDefaultAgentForDextoProject(autoInstall = true) {
|
|
151
151
|
import_core.logger.debug("Resolving default agent for dexto project context");
|
|
152
152
|
const projectRoot = (0, import_execution_context.findDextoProjectRoot)();
|
|
153
153
|
if (!projectRoot) {
|
|
154
154
|
throw import_config.ConfigError.unknownContext("dexto-project: project root not found");
|
|
155
155
|
}
|
|
156
156
|
const candidatePaths = [
|
|
157
|
-
import_path.default.join(projectRoot, "
|
|
158
|
-
import_path.default.join(projectRoot, "agents", "
|
|
159
|
-
import_path.default.join(projectRoot, "src", "dexto", "agents", "
|
|
157
|
+
import_path.default.join(projectRoot, "coding-agent.yml"),
|
|
158
|
+
import_path.default.join(projectRoot, "agents", "coding-agent.yml"),
|
|
159
|
+
import_path.default.join(projectRoot, "src", "dexto", "agents", "coding-agent.yml")
|
|
160
160
|
];
|
|
161
161
|
for (const p of candidatePaths) {
|
|
162
162
|
try {
|
|
@@ -165,7 +165,7 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true, injectPref
|
|
|
165
165
|
} catch {
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
import_core.logger.debug(`No project-local
|
|
168
|
+
import_core.logger.debug(`No project-local coding-agent.yml found in ${projectRoot}`);
|
|
169
169
|
if (!(0, import_loader.globalPreferencesExist)()) {
|
|
170
170
|
throw import_config.ConfigError.noProjectDefault(projectRoot);
|
|
171
171
|
}
|
|
@@ -174,9 +174,9 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true, injectPref
|
|
|
174
174
|
throw import_config.ConfigError.setupIncomplete();
|
|
175
175
|
}
|
|
176
176
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
177
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
177
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
178
178
|
}
|
|
179
|
-
async function resolveDefaultAgentForGlobalCLI(autoInstall = true
|
|
179
|
+
async function resolveDefaultAgentForGlobalCLI(autoInstall = true) {
|
|
180
180
|
import_core.logger.debug("Resolving default agent for global CLI context");
|
|
181
181
|
if (!(0, import_loader.globalPreferencesExist)()) {
|
|
182
182
|
throw import_config.ConfigError.noGlobalPreferences();
|
|
@@ -186,7 +186,7 @@ async function resolveDefaultAgentForGlobalCLI(autoInstall = true, injectPrefere
|
|
|
186
186
|
throw import_config.ConfigError.setupIncomplete();
|
|
187
187
|
}
|
|
188
188
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
189
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
189
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
190
190
|
}
|
|
191
191
|
async function updateDefaultAgentPreference(agentName) {
|
|
192
192
|
const agentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
package/dist/resolver.d.ts
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* Resolve agent path with automatic installation if needed
|
|
3
3
|
* @param nameOrPath Optional agent name or explicit path
|
|
4
4
|
* @param autoInstall Whether to automatically install missing agents from bundled registry (default: true)
|
|
5
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
6
5
|
* @returns Resolved absolute path to agent config
|
|
7
6
|
* @throws {ConfigError} For path/config issues (file not found, unknown context, setup incomplete)
|
|
8
7
|
* @throws {RegistryError} For agent lookup failures (agent not found, not installed)
|
|
9
8
|
*/
|
|
10
|
-
export declare function resolveAgentPath(nameOrPath?: string, autoInstall?: boolean
|
|
9
|
+
export declare function resolveAgentPath(nameOrPath?: string, autoInstall?: boolean): Promise<string>;
|
|
11
10
|
/**
|
|
12
11
|
* Update default agent preference
|
|
13
12
|
* @param agentName The agent name to set as the new default
|
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAoCA
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAoCA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAClC,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,GAAE,OAAc,GAC5B,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAiMD;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BnF"}
|
package/dist/resolver.js
CHANGED
|
@@ -12,7 +12,7 @@ import { ConfigError } from "./config/index.js";
|
|
|
12
12
|
import { RegistryError } from "./registry/errors.js";
|
|
13
13
|
import { AgentManager } from "./AgentManager.js";
|
|
14
14
|
import { installBundledAgent } from "./installation.js";
|
|
15
|
-
async function resolveAgentPath(nameOrPath, autoInstall = true
|
|
15
|
+
async function resolveAgentPath(nameOrPath, autoInstall = true) {
|
|
16
16
|
if (nameOrPath && isPath(nameOrPath)) {
|
|
17
17
|
const resolved = path.resolve(nameOrPath);
|
|
18
18
|
try {
|
|
@@ -26,11 +26,11 @@ async function resolveAgentPath(nameOrPath, autoInstall = true, injectPreference
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (nameOrPath) {
|
|
29
|
-
return await resolveAgentByName(nameOrPath, autoInstall
|
|
29
|
+
return await resolveAgentByName(nameOrPath, autoInstall);
|
|
30
30
|
}
|
|
31
|
-
return await resolveDefaultAgentByContext(autoInstall
|
|
31
|
+
return await resolveDefaultAgentByContext(autoInstall);
|
|
32
32
|
}
|
|
33
|
-
async function resolveAgentByName(agentId, autoInstall
|
|
33
|
+
async function resolveAgentByName(agentId, autoInstall) {
|
|
34
34
|
const agentsDir = getDextoGlobalPath("agents");
|
|
35
35
|
const installedRegistryPath = path.join(agentsDir, "registry.json");
|
|
36
36
|
try {
|
|
@@ -46,7 +46,7 @@ async function resolveAgentByName(agentId, autoInstall, injectPreferences) {
|
|
|
46
46
|
if (autoInstall) {
|
|
47
47
|
try {
|
|
48
48
|
logger.info(`Auto-installing agent '${agentId}' from bundled registry`);
|
|
49
|
-
const configPath = await installBundledAgent(agentId
|
|
49
|
+
const configPath = await installBundledAgent(agentId);
|
|
50
50
|
return configPath;
|
|
51
51
|
} catch (error) {
|
|
52
52
|
logger.debug(`Failed to auto-install agent '${agentId}': ${error}`);
|
|
@@ -67,26 +67,26 @@ async function getAgentConfigPath(agentId) {
|
|
|
67
67
|
}
|
|
68
68
|
return path.resolve(path.dirname(installedRegistryPath), agentEntry.configPath);
|
|
69
69
|
}
|
|
70
|
-
async function resolveDefaultAgentByContext(autoInstall = true
|
|
70
|
+
async function resolveDefaultAgentByContext(autoInstall = true) {
|
|
71
71
|
const executionContext = getExecutionContext();
|
|
72
72
|
switch (executionContext) {
|
|
73
73
|
case "dexto-source":
|
|
74
|
-
return await resolveDefaultAgentForDextoSource(autoInstall
|
|
74
|
+
return await resolveDefaultAgentForDextoSource(autoInstall);
|
|
75
75
|
case "dexto-project":
|
|
76
|
-
return await resolveDefaultAgentForDextoProject(autoInstall
|
|
76
|
+
return await resolveDefaultAgentForDextoProject(autoInstall);
|
|
77
77
|
case "global-cli":
|
|
78
|
-
return await resolveDefaultAgentForGlobalCLI(autoInstall
|
|
78
|
+
return await resolveDefaultAgentForGlobalCLI(autoInstall);
|
|
79
79
|
default:
|
|
80
80
|
throw ConfigError.unknownContext(executionContext);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
async function resolveDefaultAgentForDextoSource(autoInstall = true
|
|
83
|
+
async function resolveDefaultAgentForDextoSource(autoInstall = true) {
|
|
84
84
|
logger.debug("Resolving default agent for dexto source context");
|
|
85
85
|
const sourceRoot = findDextoSourceRoot();
|
|
86
86
|
if (!sourceRoot) {
|
|
87
87
|
throw ConfigError.bundledNotFound("dexto source directory not found");
|
|
88
88
|
}
|
|
89
|
-
const repoConfigPath = path.join(sourceRoot, "agents", "
|
|
89
|
+
const repoConfigPath = path.join(sourceRoot, "agents", "coding-agent", "coding-agent.yml");
|
|
90
90
|
const isDevMode = process.env.DEXTO_DEV_MODE === "true";
|
|
91
91
|
if (isDevMode) {
|
|
92
92
|
logger.debug("Dev mode: using repository config file");
|
|
@@ -103,7 +103,7 @@ async function resolveDefaultAgentForDextoSource(autoInstall = true, injectPrefe
|
|
|
103
103
|
if (preferences.setup.completed) {
|
|
104
104
|
logger.debug("Using user preferences in dexto-source context");
|
|
105
105
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
106
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
106
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
107
107
|
}
|
|
108
108
|
} catch (error) {
|
|
109
109
|
logger.warn(`Failed to load preferences, falling back to repo config: ${error}`);
|
|
@@ -117,16 +117,16 @@ async function resolveDefaultAgentForDextoSource(autoInstall = true, injectPrefe
|
|
|
117
117
|
throw ConfigError.bundledNotFound(repoConfigPath);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
async function resolveDefaultAgentForDextoProject(autoInstall = true
|
|
120
|
+
async function resolveDefaultAgentForDextoProject(autoInstall = true) {
|
|
121
121
|
logger.debug("Resolving default agent for dexto project context");
|
|
122
122
|
const projectRoot = findDextoProjectRoot();
|
|
123
123
|
if (!projectRoot) {
|
|
124
124
|
throw ConfigError.unknownContext("dexto-project: project root not found");
|
|
125
125
|
}
|
|
126
126
|
const candidatePaths = [
|
|
127
|
-
path.join(projectRoot, "
|
|
128
|
-
path.join(projectRoot, "agents", "
|
|
129
|
-
path.join(projectRoot, "src", "dexto", "agents", "
|
|
127
|
+
path.join(projectRoot, "coding-agent.yml"),
|
|
128
|
+
path.join(projectRoot, "agents", "coding-agent.yml"),
|
|
129
|
+
path.join(projectRoot, "src", "dexto", "agents", "coding-agent.yml")
|
|
130
130
|
];
|
|
131
131
|
for (const p of candidatePaths) {
|
|
132
132
|
try {
|
|
@@ -135,7 +135,7 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true, injectPref
|
|
|
135
135
|
} catch {
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
logger.debug(`No project-local
|
|
138
|
+
logger.debug(`No project-local coding-agent.yml found in ${projectRoot}`);
|
|
139
139
|
if (!globalPreferencesExist()) {
|
|
140
140
|
throw ConfigError.noProjectDefault(projectRoot);
|
|
141
141
|
}
|
|
@@ -144,9 +144,9 @@ async function resolveDefaultAgentForDextoProject(autoInstall = true, injectPref
|
|
|
144
144
|
throw ConfigError.setupIncomplete();
|
|
145
145
|
}
|
|
146
146
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
147
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
147
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
148
148
|
}
|
|
149
|
-
async function resolveDefaultAgentForGlobalCLI(autoInstall = true
|
|
149
|
+
async function resolveDefaultAgentForGlobalCLI(autoInstall = true) {
|
|
150
150
|
logger.debug("Resolving default agent for global CLI context");
|
|
151
151
|
if (!globalPreferencesExist()) {
|
|
152
152
|
throw ConfigError.noGlobalPreferences();
|
|
@@ -156,7 +156,7 @@ async function resolveDefaultAgentForGlobalCLI(autoInstall = true, injectPrefere
|
|
|
156
156
|
throw ConfigError.setupIncomplete();
|
|
157
157
|
}
|
|
158
158
|
const preferredAgentName = preferences.defaults.defaultAgent;
|
|
159
|
-
return await resolveAgentByName(preferredAgentName, autoInstall
|
|
159
|
+
return await resolveAgentByName(preferredAgentName, autoInstall);
|
|
160
160
|
}
|
|
161
161
|
async function updateDefaultAgentPreference(agentName) {
|
|
162
162
|
const agentsDir = getDextoGlobalPath("agents");
|