@dexto/agent-management 1.5.7 → 1.5.8
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/config/config-enrichment.cjs +2 -1
- package/dist/config/config-enrichment.d.ts.map +1 -1
- package/dist/config/config-enrichment.js +2 -1
- package/dist/index.cjs +11 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/models/custom-models.cjs +1 -1
- package/dist/models/custom-models.d.ts +7 -7
- package/dist/models/custom-models.d.ts.map +1 -1
- package/dist/models/custom-models.js +1 -1
- package/dist/plugins/discover-skills.cjs +4 -0
- package/dist/plugins/discover-skills.d.ts +6 -3
- package/dist/plugins/discover-skills.d.ts.map +1 -1
- package/dist/plugins/discover-skills.js +4 -0
- package/dist/preferences/errors.cjs +11 -0
- package/dist/preferences/errors.d.ts +1 -0
- package/dist/preferences/errors.d.ts.map +1 -1
- package/dist/preferences/errors.js +11 -0
- package/dist/preferences/loader.cjs +119 -6
- package/dist/preferences/loader.d.ts +21 -1
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +102 -1
- package/dist/preferences/schemas.cjs +12 -0
- package/dist/preferences/schemas.d.ts +38 -12
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +10 -0
- package/dist/tool-provider/llm-resolution.cjs +1 -1
- package/dist/tool-provider/llm-resolution.d.ts +4 -4
- package/dist/tool-provider/llm-resolution.js +1 -1
- package/dist/tool-provider/runtime-service.cjs +90 -13
- package/dist/tool-provider/runtime-service.d.ts +2 -0
- package/dist/tool-provider/runtime-service.d.ts.map +1 -1
- package/dist/tool-provider/runtime-service.js +80 -13
- package/dist/tool-provider/tool-provider.cjs +152 -1
- package/dist/tool-provider/tool-provider.d.ts +7 -1
- package/dist/tool-provider/tool-provider.d.ts.map +1 -1
- package/dist/tool-provider/tool-provider.js +159 -1
- package/dist/utils/api-key-resolver.cjs +1 -1
- package/dist/utils/api-key-resolver.js +1 -1
- package/dist/utils/feature-flags.cjs +3 -1
- package/dist/utils/feature-flags.d.ts +2 -2
- package/dist/utils/feature-flags.d.ts.map +1 -1
- package/dist/utils/feature-flags.js +3 -1
- package/package.json +3 -2
|
@@ -182,7 +182,8 @@ function enrichAgentConfig(config, configPath, options = {}) {
|
|
|
182
182
|
enriched.prompts.push(promptEntry);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
const
|
|
185
|
+
const shouldDiscoverAgentInstructions = config.agentFile?.discoverInCwd !== void 0 ? config.agentFile.discoverInCwd : true;
|
|
186
|
+
const instructionFile = shouldDiscoverAgentInstructions ? (0, import_discover_prompts.discoverAgentInstructionFile)() : null;
|
|
186
187
|
if (instructionFile) {
|
|
187
188
|
const fileContributor = {
|
|
188
189
|
id: "discovered-instructions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-enrichment.d.ts","sourceRoot":"","sources":["../../src/config/config-enrichment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU/C,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAoC9E;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,mGAAmG;IACnG,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/C,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,wBAAwB,GAAG,OAAY,GACjD,WAAW,
|
|
1
|
+
{"version":3,"file":"config-enrichment.d.ts","sourceRoot":"","sources":["../../src/config/config-enrichment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU/C,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAoC9E;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,mGAAmG;IACnG,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/C,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,wBAAwB,GAAG,OAAY,GACjD,WAAW,CAgQb"}
|
|
@@ -150,7 +150,8 @@ function enrichAgentConfig(config, configPath, options = {}) {
|
|
|
150
150
|
enriched.prompts.push(promptEntry);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const shouldDiscoverAgentInstructions = config.agentFile?.discoverInCwd !== void 0 ? config.agentFile.discoverInCwd : true;
|
|
154
|
+
const instructionFile = shouldDiscoverAgentInstructions ? discoverAgentInstructionFile() : null;
|
|
154
155
|
if (instructionFile) {
|
|
155
156
|
const fileContributor = {
|
|
156
157
|
id: "discovered-instructions",
|
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
addMarketplace: () => import_plugins.addMarketplace,
|
|
43
43
|
addPromptToAgentConfig: () => import_config.addPromptToAgentConfig,
|
|
44
44
|
addToDownloadQueue: () => import_models.addToDownloadQueue,
|
|
45
|
+
agentPreferencesExist: () => import_loader2.agentPreferencesExist,
|
|
45
46
|
canUseDextoProvider: () => import_dexto_auth.canUseDextoProvider,
|
|
46
47
|
copyDirectory: () => import_path.copyDirectory,
|
|
47
48
|
createInitialPreferences: () => import_loader.createInitialPreferences,
|
|
@@ -62,6 +63,7 @@ __export(index_exports, {
|
|
|
62
63
|
formatSize: () => import_models.formatSize,
|
|
63
64
|
getActiveModel: () => import_models.getActiveModel,
|
|
64
65
|
getActiveModelId: () => import_models.getActiveModelId,
|
|
66
|
+
getAgentPreferencesPath: () => import_loader2.getAgentPreferencesPath,
|
|
65
67
|
getAgentRegistry: () => import_registry.getAgentRegistry,
|
|
66
68
|
getAllInstalledModels: () => import_models.getAllInstalledModels,
|
|
67
69
|
getCustomModel: () => import_custom_models.getCustomModel,
|
|
@@ -106,6 +108,7 @@ __export(index_exports, {
|
|
|
106
108
|
listModelDirectories: () => import_models.listModelDirectories,
|
|
107
109
|
listProviderKeyStatus: () => import_api_key_store.listProviderKeyStatus,
|
|
108
110
|
loadAgentConfig: () => import_config.loadAgentConfig,
|
|
111
|
+
loadAgentPreferences: () => import_loader2.loadAgentPreferences,
|
|
109
112
|
loadBundledRegistryAgents: () => import_registry.loadBundledRegistryAgents,
|
|
110
113
|
loadClaudeCodePlugin: () => import_plugins.loadClaudeCodePlugin,
|
|
111
114
|
loadCustomModels: () => import_custom_models.loadCustomModels,
|
|
@@ -123,6 +126,7 @@ __export(index_exports, {
|
|
|
123
126
|
resolveAgentPath: () => import_resolver.resolveAgentPath,
|
|
124
127
|
resolveApiKeyForProvider: () => import_api_key_resolver.resolveApiKeyForProvider,
|
|
125
128
|
resolveBundledScript: () => import_path.resolveBundledScript,
|
|
129
|
+
saveAgentPreferences: () => import_loader2.saveAgentPreferences,
|
|
126
130
|
saveCustomModel: () => import_custom_models.saveCustomModel,
|
|
127
131
|
saveDextoInstalledPlugins: () => import_plugins.saveDextoInstalledPlugins,
|
|
128
132
|
saveGlobalPreferences: () => import_loader.saveGlobalPreferences,
|
|
@@ -134,6 +138,7 @@ __export(index_exports, {
|
|
|
134
138
|
uninstallAgent: () => import_installation.uninstallAgent,
|
|
135
139
|
uninstallPlugin: () => import_plugins.uninstallPlugin,
|
|
136
140
|
updateAgentConfigFile: () => import_config.updateAgentConfigFile,
|
|
141
|
+
updateAgentPreferences: () => import_loader2.updateAgentPreferences,
|
|
137
142
|
updateDefaultAgentPreference: () => import_resolver.updateDefaultAgentPreference,
|
|
138
143
|
updateEnvFile: () => import_env_file.updateEnvFile,
|
|
139
144
|
updateGlobalPreferences: () => import_loader.updateGlobalPreferences,
|
|
@@ -152,6 +157,7 @@ var import_types = require("./registry/types.js");
|
|
|
152
157
|
var import_errors = require("./registry/errors.js");
|
|
153
158
|
var import_error_codes = require("./registry/error-codes.js");
|
|
154
159
|
var import_loader = require("./preferences/loader.js");
|
|
160
|
+
var import_loader2 = require("./preferences/loader.js");
|
|
155
161
|
var import_errors2 = require("./preferences/errors.js");
|
|
156
162
|
var import_resolver = require("./resolver.js");
|
|
157
163
|
var import_writer = require("./writer.js");
|
|
@@ -197,6 +203,7 @@ var import_plugins = require("./plugins/index.js");
|
|
|
197
203
|
addMarketplace,
|
|
198
204
|
addPromptToAgentConfig,
|
|
199
205
|
addToDownloadQueue,
|
|
206
|
+
agentPreferencesExist,
|
|
200
207
|
canUseDextoProvider,
|
|
201
208
|
copyDirectory,
|
|
202
209
|
createInitialPreferences,
|
|
@@ -217,6 +224,7 @@ var import_plugins = require("./plugins/index.js");
|
|
|
217
224
|
formatSize,
|
|
218
225
|
getActiveModel,
|
|
219
226
|
getActiveModelId,
|
|
227
|
+
getAgentPreferencesPath,
|
|
220
228
|
getAgentRegistry,
|
|
221
229
|
getAllInstalledModels,
|
|
222
230
|
getCustomModel,
|
|
@@ -261,6 +269,7 @@ var import_plugins = require("./plugins/index.js");
|
|
|
261
269
|
listModelDirectories,
|
|
262
270
|
listProviderKeyStatus,
|
|
263
271
|
loadAgentConfig,
|
|
272
|
+
loadAgentPreferences,
|
|
264
273
|
loadBundledRegistryAgents,
|
|
265
274
|
loadClaudeCodePlugin,
|
|
266
275
|
loadCustomModels,
|
|
@@ -278,6 +287,7 @@ var import_plugins = require("./plugins/index.js");
|
|
|
278
287
|
resolveAgentPath,
|
|
279
288
|
resolveApiKeyForProvider,
|
|
280
289
|
resolveBundledScript,
|
|
290
|
+
saveAgentPreferences,
|
|
281
291
|
saveCustomModel,
|
|
282
292
|
saveDextoInstalledPlugins,
|
|
283
293
|
saveGlobalPreferences,
|
|
@@ -289,6 +299,7 @@ var import_plugins = require("./plugins/index.js");
|
|
|
289
299
|
uninstallAgent,
|
|
290
300
|
uninstallPlugin,
|
|
291
301
|
updateAgentConfigFile,
|
|
302
|
+
updateAgentPreferences,
|
|
292
303
|
updateDefaultAgentPreference,
|
|
293
304
|
updateEnvFile,
|
|
294
305
|
updateGlobalPreferences,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export { deriveDisplayName } from './registry/types.js';
|
|
|
4
4
|
export { RegistryError } from './registry/errors.js';
|
|
5
5
|
export { RegistryErrorCode } from './registry/error-codes.js';
|
|
6
6
|
export { loadGlobalPreferences, saveGlobalPreferences, globalPreferencesExist, getGlobalPreferencesPath, createInitialPreferences, updateGlobalPreferences, type GlobalPreferencesUpdates, type CreatePreferencesOptions, } from './preferences/loader.js';
|
|
7
|
-
export type { GlobalPreferences } from './preferences/schemas.js';
|
|
7
|
+
export type { GlobalPreferences, AgentPreferences } from './preferences/schemas.js';
|
|
8
|
+
export { loadAgentPreferences, saveAgentPreferences, updateAgentPreferences, agentPreferencesExist, getAgentPreferencesPath, } from './preferences/loader.js';
|
|
8
9
|
export { PreferenceError, PreferenceErrorCode } from './preferences/errors.js';
|
|
9
10
|
export { resolveAgentPath, updateDefaultAgentPreference } from './resolver.js';
|
|
10
11
|
export { writeConfigFile, writeLLMPreferences, writePreferencesToAgent, type LLMOverrides, } from './writer.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACrF,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAChC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,13 @@ import {
|
|
|
10
10
|
createInitialPreferences,
|
|
11
11
|
updateGlobalPreferences
|
|
12
12
|
} from "./preferences/loader.js";
|
|
13
|
+
import {
|
|
14
|
+
loadAgentPreferences,
|
|
15
|
+
saveAgentPreferences,
|
|
16
|
+
updateAgentPreferences,
|
|
17
|
+
agentPreferencesExist,
|
|
18
|
+
getAgentPreferencesPath
|
|
19
|
+
} from "./preferences/loader.js";
|
|
13
20
|
import { PreferenceError, PreferenceErrorCode } from "./preferences/errors.js";
|
|
14
21
|
import { resolveAgentPath, updateDefaultAgentPreference } from "./resolver.js";
|
|
15
22
|
import {
|
|
@@ -171,6 +178,7 @@ export {
|
|
|
171
178
|
addMarketplace,
|
|
172
179
|
addPromptToAgentConfig,
|
|
173
180
|
addToDownloadQueue,
|
|
181
|
+
agentPreferencesExist,
|
|
174
182
|
canUseDextoProvider,
|
|
175
183
|
copyDirectory,
|
|
176
184
|
createInitialPreferences,
|
|
@@ -191,6 +199,7 @@ export {
|
|
|
191
199
|
formatSize,
|
|
192
200
|
getActiveModel,
|
|
193
201
|
getActiveModelId,
|
|
202
|
+
getAgentPreferencesPath,
|
|
194
203
|
getAgentRegistry,
|
|
195
204
|
getAllInstalledModels,
|
|
196
205
|
getCustomModel,
|
|
@@ -235,6 +244,7 @@ export {
|
|
|
235
244
|
listModelDirectories,
|
|
236
245
|
listProviderKeyStatus,
|
|
237
246
|
loadAgentConfig,
|
|
247
|
+
loadAgentPreferences,
|
|
238
248
|
loadBundledRegistryAgents,
|
|
239
249
|
loadClaudeCodePlugin,
|
|
240
250
|
loadCustomModels,
|
|
@@ -252,6 +262,7 @@ export {
|
|
|
252
262
|
resolveAgentPath,
|
|
253
263
|
resolveApiKeyForProvider,
|
|
254
264
|
resolveBundledScript,
|
|
265
|
+
saveAgentPreferences,
|
|
255
266
|
saveCustomModel,
|
|
256
267
|
saveDextoInstalledPlugins,
|
|
257
268
|
saveGlobalPreferences,
|
|
@@ -263,6 +274,7 @@ export {
|
|
|
263
274
|
uninstallAgent,
|
|
264
275
|
uninstallPlugin,
|
|
265
276
|
updateAgentConfigFile,
|
|
277
|
+
updateAgentPreferences,
|
|
266
278
|
updateDefaultAgentPreference,
|
|
267
279
|
updateEnvFile,
|
|
268
280
|
updateGlobalPreferences,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
/** Providers that support custom models */
|
|
9
|
-
export declare const CUSTOM_MODEL_PROVIDERS: readonly ["openai-compatible", "openrouter", "litellm", "glama", "bedrock", "ollama", "local", "vertex", "dexto"];
|
|
9
|
+
export declare const CUSTOM_MODEL_PROVIDERS: readonly ["openai-compatible", "openrouter", "litellm", "glama", "bedrock", "ollama", "local", "vertex", "dexto-nova"];
|
|
10
10
|
export type CustomModelProvider = (typeof CUSTOM_MODEL_PROVIDERS)[number];
|
|
11
11
|
/**
|
|
12
12
|
* Schema for a saved custom model configuration.
|
|
@@ -18,7 +18,7 @@ export type CustomModelProvider = (typeof CUSTOM_MODEL_PROVIDERS)[number];
|
|
|
18
18
|
* - ollama: optional baseURL (defaults to http://localhost:11434)
|
|
19
19
|
* - local: no baseURL, uses local GGUF files via node-llama-cpp
|
|
20
20
|
* - vertex: no baseURL, uses Google Cloud ADC
|
|
21
|
-
* - dexto: OpenRouter gateway using Dexto credits, requires auth login, uses OpenRouter model IDs
|
|
21
|
+
* - dexto-nova: OpenRouter gateway using Dexto credits, requires auth login, uses OpenRouter model IDs
|
|
22
22
|
*
|
|
23
23
|
* TODO: For hosted deployments, API keys should be stored in a secure
|
|
24
24
|
* key management service (e.g., AWS Secrets Manager, HashiCorp Vault)
|
|
@@ -27,7 +27,7 @@ export type CustomModelProvider = (typeof CUSTOM_MODEL_PROVIDERS)[number];
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const CustomModelSchema: z.ZodEffects<z.ZodObject<{
|
|
29
29
|
name: z.ZodString;
|
|
30
|
-
provider: z.ZodDefault<z.ZodEnum<["openai-compatible", "openrouter", "litellm", "glama", "bedrock", "ollama", "local", "vertex", "dexto"]>>;
|
|
30
|
+
provider: z.ZodDefault<z.ZodEnum<["openai-compatible", "openrouter", "litellm", "glama", "bedrock", "ollama", "local", "vertex", "dexto-nova"]>>;
|
|
31
31
|
baseURL: z.ZodOptional<z.ZodString>;
|
|
32
32
|
displayName: z.ZodOptional<z.ZodString>;
|
|
33
33
|
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -37,7 +37,7 @@ export declare const CustomModelSchema: z.ZodEffects<z.ZodObject<{
|
|
|
37
37
|
reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
39
|
name: string;
|
|
40
|
-
provider: "
|
|
40
|
+
provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
41
41
|
apiKey?: string | undefined;
|
|
42
42
|
baseURL?: string | undefined;
|
|
43
43
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
@@ -47,7 +47,7 @@ export declare const CustomModelSchema: z.ZodEffects<z.ZodObject<{
|
|
|
47
47
|
maxOutputTokens?: number | undefined;
|
|
48
48
|
}, {
|
|
49
49
|
name: string;
|
|
50
|
-
provider?: "
|
|
50
|
+
provider?: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
51
51
|
apiKey?: string | undefined;
|
|
52
52
|
baseURL?: string | undefined;
|
|
53
53
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
@@ -57,7 +57,7 @@ export declare const CustomModelSchema: z.ZodEffects<z.ZodObject<{
|
|
|
57
57
|
maxOutputTokens?: number | undefined;
|
|
58
58
|
}>, {
|
|
59
59
|
name: string;
|
|
60
|
-
provider: "
|
|
60
|
+
provider: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova";
|
|
61
61
|
apiKey?: string | undefined;
|
|
62
62
|
baseURL?: string | undefined;
|
|
63
63
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
@@ -67,7 +67,7 @@ export declare const CustomModelSchema: z.ZodEffects<z.ZodObject<{
|
|
|
67
67
|
maxOutputTokens?: number | undefined;
|
|
68
68
|
}, {
|
|
69
69
|
name: string;
|
|
70
|
-
provider?: "
|
|
70
|
+
provider?: "openai-compatible" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
71
71
|
apiKey?: string | undefined;
|
|
72
72
|
baseURL?: string | undefined;
|
|
73
73
|
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-models.d.ts","sourceRoot":"","sources":["../../src/models/custom-models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"custom-models.d.ts","sourceRoot":"","sources":["../../src/models/custom-models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,wHAUzB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CxB,CAAC;AAEP,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAO7D;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAmB/D;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBvE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUtE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAG9E"}
|
|
@@ -68,8 +68,10 @@ function discoverStandaloneSkills(projectPath) {
|
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
+
scanSkillsDir(path.join(cwd, ".agents", "skills"), "project");
|
|
71
72
|
scanSkillsDir(path.join(cwd, ".dexto", "skills"), "project");
|
|
72
73
|
if (homeDir) {
|
|
74
|
+
scanSkillsDir(path.join(homeDir, ".agents", "skills"), "user");
|
|
73
75
|
scanSkillsDir(path.join(homeDir, ".dexto", "skills"), "user");
|
|
74
76
|
}
|
|
75
77
|
return skills;
|
|
@@ -78,7 +80,9 @@ function getSkillSearchPaths() {
|
|
|
78
80
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
79
81
|
const cwd = process.cwd();
|
|
80
82
|
return [
|
|
83
|
+
path.join(cwd, ".agents", "skills"),
|
|
81
84
|
path.join(cwd, ".dexto", "skills"),
|
|
85
|
+
homeDir ? path.join(homeDir, ".agents", "skills") : "",
|
|
82
86
|
homeDir ? path.join(homeDir, ".dexto", "skills") : ""
|
|
83
87
|
].filter(Boolean);
|
|
84
88
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Standalone Skill Discovery
|
|
3
3
|
*
|
|
4
|
-
* Discovers standalone skills from ~/.dexto/skills/
|
|
4
|
+
* Discovers standalone skills from ~/.agents/skills/ and ~/.dexto/skills/ directories.
|
|
5
5
|
* These are different from plugin skills - they're just directories containing a SKILL.md file.
|
|
6
6
|
*
|
|
7
7
|
* Structure:
|
|
8
|
+
* ~/.agents/skills/
|
|
8
9
|
* ~/.dexto/skills/
|
|
9
10
|
* └── skill-name/
|
|
10
11
|
* ├── SKILL.md (required - the skill prompt)
|
|
@@ -29,8 +30,10 @@ export interface DiscoveredSkill {
|
|
|
29
30
|
* Discovers standalone skills from standard locations.
|
|
30
31
|
*
|
|
31
32
|
* Search Locations:
|
|
32
|
-
* 1. <cwd>/.
|
|
33
|
-
* 2.
|
|
33
|
+
* 1. <cwd>/.agents/skills/* (project)
|
|
34
|
+
* 2. <cwd>/.dexto/skills/* (project)
|
|
35
|
+
* 3. ~/.agents/skills/* (user)
|
|
36
|
+
* 4. ~/.dexto/skills/* (user)
|
|
34
37
|
*
|
|
35
38
|
* @param projectPath Optional project path (defaults to cwd)
|
|
36
39
|
* @returns Array of discovered skills
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-skills.d.ts","sourceRoot":"","sources":["../../src/plugins/discover-skills.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"discover-skills.d.ts","sourceRoot":"","sources":["../../src/plugins/discover-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE,CAgEhF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAU9C"}
|
|
@@ -34,8 +34,10 @@ function discoverStandaloneSkills(projectPath) {
|
|
|
34
34
|
} catch {
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
scanSkillsDir(path.join(cwd, ".agents", "skills"), "project");
|
|
37
38
|
scanSkillsDir(path.join(cwd, ".dexto", "skills"), "project");
|
|
38
39
|
if (homeDir) {
|
|
40
|
+
scanSkillsDir(path.join(homeDir, ".agents", "skills"), "user");
|
|
39
41
|
scanSkillsDir(path.join(homeDir, ".dexto", "skills"), "user");
|
|
40
42
|
}
|
|
41
43
|
return skills;
|
|
@@ -44,7 +46,9 @@ function getSkillSearchPaths() {
|
|
|
44
46
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
45
47
|
const cwd = process.cwd();
|
|
46
48
|
return [
|
|
49
|
+
path.join(cwd, ".agents", "skills"),
|
|
47
50
|
path.join(cwd, ".dexto", "skills"),
|
|
51
|
+
homeDir ? path.join(homeDir, ".agents", "skills") : "",
|
|
48
52
|
homeDir ? path.join(homeDir, ".dexto", "skills") : ""
|
|
49
53
|
].filter(Boolean);
|
|
50
54
|
}
|
|
@@ -66,6 +66,17 @@ class PreferenceError {
|
|
|
66
66
|
}));
|
|
67
67
|
return new import_core.DextoValidationError(issues);
|
|
68
68
|
}
|
|
69
|
+
static invalidAgentId(agentId) {
|
|
70
|
+
return new import_core.DextoValidationError([
|
|
71
|
+
{
|
|
72
|
+
code: import_error_codes.PreferenceErrorCode.INVALID_PREFERENCE_VALUE,
|
|
73
|
+
message: `agentId is invalid: ${agentId}`,
|
|
74
|
+
scope: "preference",
|
|
75
|
+
type: import_core.ErrorType.USER,
|
|
76
|
+
severity: "error"
|
|
77
|
+
}
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
69
80
|
}
|
|
70
81
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
82
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/preferences/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAa,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IACxB,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM;;;IAW3C,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW3D,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW5D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/preferences/errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAa,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IACxB,MAAM,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM;;;IAW3C,MAAM,CAAC,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW3D,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;IAW5D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ;IAY1C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM;CAWxC"}
|
|
@@ -42,6 +42,17 @@ class PreferenceError {
|
|
|
42
42
|
}));
|
|
43
43
|
return new DextoValidationError(issues);
|
|
44
44
|
}
|
|
45
|
+
static invalidAgentId(agentId) {
|
|
46
|
+
return new DextoValidationError([
|
|
47
|
+
{
|
|
48
|
+
code: PreferenceErrorCode.INVALID_PREFERENCE_VALUE,
|
|
49
|
+
message: `agentId is invalid: ${agentId}`,
|
|
50
|
+
scope: "preference",
|
|
51
|
+
type: ErrorType.USER,
|
|
52
|
+
severity: "error"
|
|
53
|
+
}
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
45
56
|
}
|
|
46
57
|
export {
|
|
47
58
|
PreferenceError,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,28 +17,42 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var loader_exports = {};
|
|
20
30
|
__export(loader_exports, {
|
|
31
|
+
agentPreferencesExist: () => agentPreferencesExist,
|
|
21
32
|
createInitialPreferences: () => createInitialPreferences,
|
|
33
|
+
getAgentPreferencesPath: () => getAgentPreferencesPath,
|
|
22
34
|
getGlobalPreferencesPath: () => getGlobalPreferencesPath,
|
|
23
35
|
globalPreferencesExist: () => globalPreferencesExist,
|
|
36
|
+
loadAgentPreferences: () => loadAgentPreferences,
|
|
24
37
|
loadGlobalPreferences: () => loadGlobalPreferences,
|
|
38
|
+
saveAgentPreferences: () => saveAgentPreferences,
|
|
25
39
|
saveGlobalPreferences: () => saveGlobalPreferences,
|
|
40
|
+
updateAgentPreferences: () => updateAgentPreferences,
|
|
26
41
|
updateGlobalPreferences: () => updateGlobalPreferences
|
|
27
42
|
});
|
|
28
43
|
module.exports = __toCommonJS(loader_exports);
|
|
29
44
|
var import_fs = require("fs");
|
|
30
45
|
var import_fs2 = require("fs");
|
|
31
46
|
var import_yaml = require("yaml");
|
|
32
|
-
var import_path = require("
|
|
47
|
+
var import_path = __toESM(require("path"), 1);
|
|
48
|
+
var import_path2 = require("../utils/path.js");
|
|
33
49
|
var import_core = require("@dexto/core");
|
|
34
50
|
var import_core2 = require("@dexto/core");
|
|
35
51
|
var import_schemas = require("./schemas.js");
|
|
36
52
|
var import_constants = require("./constants.js");
|
|
37
53
|
var import_errors = require("./errors.js");
|
|
38
54
|
async function loadGlobalPreferences() {
|
|
39
|
-
const preferencesPath = (0,
|
|
55
|
+
const preferencesPath = (0, import_path2.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
40
56
|
if (!(0, import_fs.existsSync)(preferencesPath)) {
|
|
41
57
|
throw import_errors.PreferenceError.fileNotFound(preferencesPath);
|
|
42
58
|
}
|
|
@@ -70,15 +86,107 @@ const PREFERENCES_FILE_HEADER = `# Dexto Global Preferences
|
|
|
70
86
|
# Set sounds.enabled: false to disable all sounds.
|
|
71
87
|
|
|
72
88
|
`;
|
|
89
|
+
const AGENT_PREFERENCES_FILE_HEADER = `# Dexto Agent Preferences
|
|
90
|
+
# Stored per-agent to customize runtime behavior without changing base config.
|
|
91
|
+
# Tool control:
|
|
92
|
+
# tools.disabled: list of tool names to exclude from LLM context.
|
|
93
|
+
|
|
94
|
+
`;
|
|
95
|
+
function getAgentPreferencesPath(agentId) {
|
|
96
|
+
if (!agentId || typeof agentId !== "string") {
|
|
97
|
+
throw import_errors.PreferenceError.invalidAgentId(String(agentId));
|
|
98
|
+
}
|
|
99
|
+
const trimmedId = agentId.trim();
|
|
100
|
+
if (!trimmedId) {
|
|
101
|
+
throw import_errors.PreferenceError.invalidAgentId(agentId);
|
|
102
|
+
}
|
|
103
|
+
const hasSeparators = trimmedId.includes("/") || trimmedId.includes("\\");
|
|
104
|
+
if (hasSeparators || trimmedId !== import_path.default.basename(trimmedId)) {
|
|
105
|
+
throw import_errors.PreferenceError.invalidAgentId(agentId);
|
|
106
|
+
}
|
|
107
|
+
const allowedPattern = /^[a-zA-Z0-9_-]+$/;
|
|
108
|
+
if (!allowedPattern.test(trimmedId)) {
|
|
109
|
+
throw import_errors.PreferenceError.invalidAgentId(agentId);
|
|
110
|
+
}
|
|
111
|
+
const filename = `${trimmedId}.preferences.yml`;
|
|
112
|
+
return (0, import_path2.getDextoGlobalPath)(import_path.default.join("agents", filename));
|
|
113
|
+
}
|
|
114
|
+
async function loadAgentPreferences(agentId) {
|
|
115
|
+
const preferencesPath = getAgentPreferencesPath(agentId);
|
|
116
|
+
if (!(0, import_fs.existsSync)(preferencesPath)) {
|
|
117
|
+
throw import_errors.PreferenceError.fileNotFound(preferencesPath);
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const fileContent = await import_fs2.promises.readFile(preferencesPath, "utf-8");
|
|
121
|
+
const rawPreferences = (0, import_yaml.parse)(fileContent);
|
|
122
|
+
const validation = import_schemas.AgentPreferencesSchema.safeParse(rawPreferences);
|
|
123
|
+
if (!validation.success) {
|
|
124
|
+
throw import_errors.PreferenceError.validationFailed(validation.error);
|
|
125
|
+
}
|
|
126
|
+
import_core.logger.debug(`Loaded agent preferences from: ${preferencesPath}`);
|
|
127
|
+
return validation.data;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (error instanceof import_core2.DextoValidationError || error instanceof import_core2.DextoRuntimeError) {
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
throw import_errors.PreferenceError.fileReadError(
|
|
133
|
+
preferencesPath,
|
|
134
|
+
error instanceof Error ? error.message : String(error)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function saveAgentPreferences(agentId, preferences) {
|
|
139
|
+
const preferencesPath = getAgentPreferencesPath(agentId);
|
|
140
|
+
const validation = import_schemas.AgentPreferencesSchema.safeParse(preferences);
|
|
141
|
+
if (!validation.success) {
|
|
142
|
+
throw import_errors.PreferenceError.validationFailed(validation.error);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
import_core.logger.debug(`Saving agent preferences to: ${preferencesPath}`);
|
|
146
|
+
await import_fs2.promises.mkdir(import_path.default.dirname(preferencesPath), { recursive: true });
|
|
147
|
+
const yamlContent = (0, import_yaml.stringify)(preferences, {
|
|
148
|
+
indent: 2,
|
|
149
|
+
lineWidth: 100,
|
|
150
|
+
minContentWidth: 20
|
|
151
|
+
});
|
|
152
|
+
await import_fs2.promises.writeFile(preferencesPath, AGENT_PREFERENCES_FILE_HEADER + yamlContent, "utf-8");
|
|
153
|
+
import_core.logger.debug(
|
|
154
|
+
`\u2713 Saved agent preferences ${JSON.stringify(preferences)} to: ${preferencesPath}`
|
|
155
|
+
);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
throw import_errors.PreferenceError.fileWriteError(
|
|
158
|
+
preferencesPath,
|
|
159
|
+
error instanceof Error ? error.message : String(error)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function agentPreferencesExist(agentId) {
|
|
164
|
+
const preferencesPath = getAgentPreferencesPath(agentId);
|
|
165
|
+
return (0, import_fs.existsSync)(preferencesPath);
|
|
166
|
+
}
|
|
167
|
+
async function updateAgentPreferences(agentId, updates) {
|
|
168
|
+
const existing = await loadAgentPreferences(agentId);
|
|
169
|
+
const merged = {
|
|
170
|
+
...existing,
|
|
171
|
+
...updates,
|
|
172
|
+
tools: updates.tools ? { ...existing.tools, ...updates.tools } : existing.tools
|
|
173
|
+
};
|
|
174
|
+
const validation = import_schemas.AgentPreferencesSchema.safeParse(merged);
|
|
175
|
+
if (!validation.success) {
|
|
176
|
+
throw import_errors.PreferenceError.validationFailed(validation.error);
|
|
177
|
+
}
|
|
178
|
+
await saveAgentPreferences(agentId, validation.data);
|
|
179
|
+
return validation.data;
|
|
180
|
+
}
|
|
73
181
|
async function saveGlobalPreferences(preferences) {
|
|
74
|
-
const preferencesPath = (0,
|
|
182
|
+
const preferencesPath = (0, import_path2.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
75
183
|
const validation = import_schemas.GlobalPreferencesSchema.safeParse(preferences);
|
|
76
184
|
if (!validation.success) {
|
|
77
185
|
throw import_errors.PreferenceError.validationFailed(validation.error);
|
|
78
186
|
}
|
|
79
187
|
try {
|
|
80
188
|
import_core.logger.debug(`Saving global preferences to: ${preferencesPath}`);
|
|
81
|
-
const dextoDir = (0,
|
|
189
|
+
const dextoDir = (0, import_path2.getDextoGlobalPath)("");
|
|
82
190
|
await import_fs2.promises.mkdir(dextoDir, { recursive: true });
|
|
83
191
|
const yamlContent = (0, import_yaml.stringify)(preferences, {
|
|
84
192
|
indent: 2,
|
|
@@ -97,11 +205,11 @@ async function saveGlobalPreferences(preferences) {
|
|
|
97
205
|
}
|
|
98
206
|
}
|
|
99
207
|
function globalPreferencesExist() {
|
|
100
|
-
const preferencesPath = (0,
|
|
208
|
+
const preferencesPath = (0, import_path2.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
101
209
|
return (0, import_fs.existsSync)(preferencesPath);
|
|
102
210
|
}
|
|
103
211
|
function getGlobalPreferencesPath() {
|
|
104
|
-
return (0,
|
|
212
|
+
return (0, import_path2.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
105
213
|
}
|
|
106
214
|
function createInitialPreferences(options) {
|
|
107
215
|
const llmConfig = {
|
|
@@ -156,10 +264,15 @@ async function updateGlobalPreferences(updates) {
|
|
|
156
264
|
}
|
|
157
265
|
// Annotate the CommonJS export names for ESM import in node:
|
|
158
266
|
0 && (module.exports = {
|
|
267
|
+
agentPreferencesExist,
|
|
159
268
|
createInitialPreferences,
|
|
269
|
+
getAgentPreferencesPath,
|
|
160
270
|
getGlobalPreferencesPath,
|
|
161
271
|
globalPreferencesExist,
|
|
272
|
+
loadAgentPreferences,
|
|
162
273
|
loadGlobalPreferences,
|
|
274
|
+
saveAgentPreferences,
|
|
163
275
|
saveGlobalPreferences,
|
|
276
|
+
updateAgentPreferences,
|
|
164
277
|
updateGlobalPreferences
|
|
165
278
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LLMProvider } from '@dexto/core';
|
|
2
|
-
import { type GlobalPreferences } from './schemas.js';
|
|
2
|
+
import { type AgentPreferences, type GlobalPreferences } from './schemas.js';
|
|
3
3
|
/**
|
|
4
4
|
* Load global preferences from ~/.dexto/preferences.yml
|
|
5
5
|
* @returns Global preferences object
|
|
@@ -7,6 +7,26 @@ import { type GlobalPreferences } from './schemas.js';
|
|
|
7
7
|
* @throws DextoValidationError if preferences are invalid
|
|
8
8
|
*/
|
|
9
9
|
export declare function loadGlobalPreferences(): Promise<GlobalPreferences>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the agent preferences file path for an agent ID.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAgentPreferencesPath(agentId: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Load agent preferences from ~/.dexto/agents/<agentId>.preferences.yml
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadAgentPreferences(agentId: string): Promise<AgentPreferences>;
|
|
18
|
+
/**
|
|
19
|
+
* Save agent preferences to ~/.dexto/agents/<agentId>.preferences.yml
|
|
20
|
+
*/
|
|
21
|
+
export declare function saveAgentPreferences(agentId: string, preferences: AgentPreferences): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if agent preferences exist (for first-time detection)
|
|
24
|
+
*/
|
|
25
|
+
export declare function agentPreferencesExist(agentId: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Update agent preferences with partial updates
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateAgentPreferences(agentId: string, updates: Partial<AgentPreferences>): Promise<AgentPreferences>;
|
|
10
30
|
/**
|
|
11
31
|
* Save global preferences to ~/.dexto/preferences.yml
|
|
12
32
|
* @param preferences Validated preferences object
|