@dexto/agent-management 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config-enrichment.d.ts +4 -3
- package/dist/config/config-enrichment.d.ts.map +1 -1
- package/dist/config/discover-prompts.cjs +24 -19
- package/dist/config/discover-prompts.d.ts +13 -5
- package/dist/config/discover-prompts.d.ts.map +1 -1
- package/dist/config/discover-prompts.js +24 -19
- package/dist/index.cjs +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/preferences/index.cjs +2 -0
- package/dist/preferences/index.d.ts +2 -2
- package/dist/preferences/index.d.ts.map +1 -1
- package/dist/preferences/index.js +3 -1
- package/dist/preferences/loader.cjs +39 -41
- package/dist/preferences/loader.d.ts +7 -5
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +39 -41
- package/dist/preferences/schemas.cjs +14 -2
- package/dist/preferences/schemas.d.ts +37 -0
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +12 -1
- package/dist/runtime/AgentPool.cjs +181 -0
- package/dist/runtime/AgentPool.d.ts +76 -0
- package/dist/runtime/AgentPool.d.ts.map +1 -0
- package/dist/runtime/AgentPool.js +160 -0
- package/dist/runtime/AgentRuntime.cjs +225 -0
- package/dist/runtime/AgentRuntime.d.ts +77 -0
- package/dist/runtime/AgentRuntime.d.ts.map +1 -0
- package/dist/runtime/AgentRuntime.js +201 -0
- package/dist/runtime/approval-delegation.cjs +97 -0
- package/dist/runtime/approval-delegation.d.ts +30 -0
- package/dist/runtime/approval-delegation.d.ts.map +1 -0
- package/dist/runtime/approval-delegation.js +73 -0
- package/dist/runtime/error-codes.cjs +40 -0
- package/dist/runtime/error-codes.d.ts +17 -0
- package/dist/runtime/error-codes.d.ts.map +1 -0
- package/dist/runtime/error-codes.js +16 -0
- package/dist/runtime/errors.cjs +135 -0
- package/dist/runtime/errors.d.ts +40 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +111 -0
- package/dist/runtime/index.cjs +53 -0
- package/dist/runtime/index.d.ts +19 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +26 -0
- package/dist/runtime/schemas.cjs +64 -0
- package/dist/runtime/schemas.d.ts +69 -0
- package/dist/runtime/schemas.d.ts.map +1 -0
- package/dist/runtime/schemas.js +35 -0
- package/dist/runtime/types.cjs +16 -0
- package/dist/runtime/types.d.ts +94 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +0 -0
- package/dist/tool-provider/error-codes.cjs +35 -0
- package/dist/tool-provider/error-codes.d.ts +11 -0
- package/dist/tool-provider/error-codes.d.ts.map +1 -0
- package/dist/tool-provider/error-codes.js +11 -0
- package/dist/tool-provider/errors.cjs +81 -0
- package/dist/tool-provider/errors.d.ts +19 -0
- package/dist/tool-provider/errors.d.ts.map +1 -0
- package/dist/tool-provider/errors.js +57 -0
- package/dist/tool-provider/index.cjs +46 -0
- package/dist/tool-provider/index.d.ts +16 -0
- package/dist/tool-provider/index.d.ts.map +1 -0
- package/dist/tool-provider/index.js +16 -0
- package/dist/tool-provider/runtime-service.cjs +390 -0
- package/dist/tool-provider/runtime-service.d.ts +83 -0
- package/dist/tool-provider/runtime-service.d.ts.map +1 -0
- package/dist/tool-provider/runtime-service.js +366 -0
- package/dist/tool-provider/schemas.cjs +73 -0
- package/dist/tool-provider/schemas.d.ts +83 -0
- package/dist/tool-provider/schemas.d.ts.map +1 -0
- package/dist/tool-provider/schemas.js +48 -0
- package/dist/tool-provider/spawn-agent-tool.cjs +89 -0
- package/dist/tool-provider/spawn-agent-tool.d.ts +10 -0
- package/dist/tool-provider/spawn-agent-tool.d.ts.map +1 -0
- package/dist/tool-provider/spawn-agent-tool.js +65 -0
- package/dist/tool-provider/tool-provider.cjs +44 -0
- package/dist/tool-provider/tool-provider.d.ts +24 -0
- package/dist/tool-provider/tool-provider.d.ts.map +1 -0
- package/dist/tool-provider/tool-provider.js +20 -0
- package/dist/tool-provider/types.cjs +16 -0
- package/dist/tool-provider/types.d.ts +17 -0
- package/dist/tool-provider/types.d.ts.map +1 -0
- package/dist/tool-provider/types.js +0 -0
- package/package.json +2 -2
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* This layer runs before agent initialization and injects explicit paths
|
|
6
6
|
* into the configuration, eliminating the need for core services to resolve paths themselves.
|
|
7
7
|
*
|
|
8
|
-
* Also discovers command prompts from:
|
|
9
|
-
* - Local: <projectRoot>/commands/ (
|
|
10
|
-
* -
|
|
8
|
+
* Also discovers command prompts from (in priority order):
|
|
9
|
+
* - Local: <projectRoot>/commands/ (dexto-source dev mode or dexto-project only)
|
|
10
|
+
* - Local: <cwd>/.dexto/commands/, <cwd>/.claude/commands/, <cwd>/.cursor/commands/
|
|
11
|
+
* - Global: ~/.dexto/commands/, ~/.claude/commands/, ~/.cursor/commands/
|
|
11
12
|
*
|
|
12
13
|
* Core services now require explicit paths - this enrichment layer provides them.
|
|
13
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-enrichment.d.ts","sourceRoot":"","sources":["../../src/config/config-enrichment.ts"],"names":[],"mappings":"AAAA
|
|
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;AAK/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;CAClD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,wBAAwB,GAAG,OAAY,GACjD,WAAW,CAoKb"}
|
|
@@ -39,6 +39,19 @@ var import_fs = require("fs");
|
|
|
39
39
|
function discoverCommandPrompts() {
|
|
40
40
|
const prompts = [];
|
|
41
41
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
42
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
43
|
+
const cwd = process.cwd();
|
|
44
|
+
const scanAndAdd = (dir) => {
|
|
45
|
+
if (!(0, import_fs.existsSync)(dir)) return;
|
|
46
|
+
const files = scanCommandsDirectory(dir);
|
|
47
|
+
for (const file of files) {
|
|
48
|
+
const basename = path.basename(file).toLowerCase();
|
|
49
|
+
if (!seenFiles.has(basename)) {
|
|
50
|
+
seenFiles.add(basename);
|
|
51
|
+
prompts.push({ type: "file", file });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
42
55
|
const context = (0, import_execution_context.getExecutionContext)();
|
|
43
56
|
let localCommandsDir = null;
|
|
44
57
|
switch (context) {
|
|
@@ -62,26 +75,18 @@ function discoverCommandPrompts() {
|
|
|
62
75
|
case "global-cli":
|
|
63
76
|
break;
|
|
64
77
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const files = scanCommandsDirectory(localCommandsDir);
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
const basename = path.basename(file).toLowerCase();
|
|
70
|
-
if (!seenFiles.has(basename)) {
|
|
71
|
-
seenFiles.add(basename);
|
|
72
|
-
prompts.push({ type: "file", file });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
78
|
+
if (localCommandsDir) {
|
|
79
|
+
scanAndAdd(localCommandsDir);
|
|
75
80
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
scanAndAdd(path.join(cwd, ".dexto", "commands"));
|
|
82
|
+
scanAndAdd(path.join(cwd, ".claude", "commands"));
|
|
83
|
+
scanAndAdd(path.join(cwd, ".cursor", "commands"));
|
|
84
|
+
scanAndAdd((0, import_path.getDextoGlobalPath)("commands"));
|
|
85
|
+
if (homeDir) {
|
|
86
|
+
scanAndAdd(path.join(homeDir, ".claude", "commands"));
|
|
87
|
+
}
|
|
88
|
+
if (homeDir) {
|
|
89
|
+
scanAndAdd(path.join(homeDir, ".cursor", "commands"));
|
|
85
90
|
}
|
|
86
91
|
return prompts;
|
|
87
92
|
}
|
|
@@ -15,12 +15,20 @@ export interface FilePromptEntry {
|
|
|
15
15
|
/**
|
|
16
16
|
* Discovers command prompts from commands/ directories.
|
|
17
17
|
*
|
|
18
|
-
* Discovery locations
|
|
19
|
-
* - dexto-source (dev mode): <sourceRoot>/commands/
|
|
20
|
-
* - dexto-project: <projectRoot>/commands/
|
|
21
|
-
* - global-cli: skip local (use global only)
|
|
18
|
+
* Discovery locations (in priority order):
|
|
22
19
|
*
|
|
23
|
-
*
|
|
20
|
+
* Local commands (project-specific):
|
|
21
|
+
* 1. <projectRoot>/commands/ (dexto-source dev mode or dexto-project only)
|
|
22
|
+
* 2. <cwd>/.dexto/commands/
|
|
23
|
+
* 3. <cwd>/.claude/commands/ (Claude Code compatibility)
|
|
24
|
+
* 4. <cwd>/.cursor/commands/ (Cursor compatibility)
|
|
25
|
+
*
|
|
26
|
+
* Global commands (user-wide):
|
|
27
|
+
* 5. ~/.dexto/commands/
|
|
28
|
+
* 6. ~/.claude/commands/ (Claude Code compatibility)
|
|
29
|
+
* 7. ~/.cursor/commands/ (Cursor compatibility)
|
|
30
|
+
*
|
|
31
|
+
* Files with the same basename are deduplicated (first found wins).
|
|
24
32
|
*
|
|
25
33
|
* @returns Array of file prompt entries for discovered .md files
|
|
26
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-prompts.d.ts","sourceRoot":"","sources":["../../src/config/discover-prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED
|
|
1
|
+
{"version":3,"file":"discover-prompts.d.ts","sourceRoot":"","sources":["../../src/config/discover-prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,EAAE,CAkF1D;AAiCD;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,GAAG,IAAI,CA0B5D"}
|
|
@@ -9,6 +9,19 @@ import { existsSync, readdirSync } from "fs";
|
|
|
9
9
|
function discoverCommandPrompts() {
|
|
10
10
|
const prompts = [];
|
|
11
11
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
12
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const scanAndAdd = (dir) => {
|
|
15
|
+
if (!existsSync(dir)) return;
|
|
16
|
+
const files = scanCommandsDirectory(dir);
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
const basename = path.basename(file).toLowerCase();
|
|
19
|
+
if (!seenFiles.has(basename)) {
|
|
20
|
+
seenFiles.add(basename);
|
|
21
|
+
prompts.push({ type: "file", file });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
12
25
|
const context = getExecutionContext();
|
|
13
26
|
let localCommandsDir = null;
|
|
14
27
|
switch (context) {
|
|
@@ -32,26 +45,18 @@ function discoverCommandPrompts() {
|
|
|
32
45
|
case "global-cli":
|
|
33
46
|
break;
|
|
34
47
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const files = scanCommandsDirectory(localCommandsDir);
|
|
38
|
-
for (const file of files) {
|
|
39
|
-
const basename = path.basename(file).toLowerCase();
|
|
40
|
-
if (!seenFiles.has(basename)) {
|
|
41
|
-
seenFiles.add(basename);
|
|
42
|
-
prompts.push({ type: "file", file });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
48
|
+
if (localCommandsDir) {
|
|
49
|
+
scanAndAdd(localCommandsDir);
|
|
45
50
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
scanAndAdd(path.join(cwd, ".dexto", "commands"));
|
|
52
|
+
scanAndAdd(path.join(cwd, ".claude", "commands"));
|
|
53
|
+
scanAndAdd(path.join(cwd, ".cursor", "commands"));
|
|
54
|
+
scanAndAdd(getDextoGlobalPath("commands"));
|
|
55
|
+
if (homeDir) {
|
|
56
|
+
scanAndAdd(path.join(homeDir, ".claude", "commands"));
|
|
57
|
+
}
|
|
58
|
+
if (homeDir) {
|
|
59
|
+
scanAndAdd(path.join(homeDir, ".cursor", "commands"));
|
|
55
60
|
}
|
|
56
61
|
return prompts;
|
|
57
62
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
20
|
var index_exports = {};
|
|
20
21
|
__export(index_exports, {
|
|
@@ -135,6 +136,8 @@ var import_api_key_store = require("./utils/api-key-store.js");
|
|
|
135
136
|
var import_api_key_resolver = require("./utils/api-key-resolver.js");
|
|
136
137
|
var import_custom_models = require("./models/custom-models.js");
|
|
137
138
|
var import_models = require("./models/index.js");
|
|
139
|
+
__reExport(index_exports, require("./runtime/index.js"), module.exports);
|
|
140
|
+
__reExport(index_exports, require("./tool-provider/index.js"), module.exports);
|
|
138
141
|
// Annotate the CommonJS export names for ESM import in node:
|
|
139
142
|
0 && (module.exports = {
|
|
140
143
|
AgentFactory,
|
|
@@ -231,5 +234,7 @@ var import_models = require("./models/index.js");
|
|
|
231
234
|
walkUpDirectories,
|
|
232
235
|
writeConfigFile,
|
|
233
236
|
writeLLMPreferences,
|
|
234
|
-
writePreferencesToAgent
|
|
237
|
+
writePreferencesToAgent,
|
|
238
|
+
...require("./runtime/index.js"),
|
|
239
|
+
...require("./tool-provider/index.js")
|
|
235
240
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,6 @@ export { saveProviderApiKey, getProviderKeyStatus, listProviderKeyStatus, determ
|
|
|
20
20
|
export { resolveApiKeyForProvider, getPrimaryApiKeyEnvVar, PROVIDER_API_KEY_MAP, } from './utils/api-key-resolver.js';
|
|
21
21
|
export { loadCustomModels, saveCustomModel, deleteCustomModel, getCustomModel, getCustomModelsPath, CustomModelSchema, CUSTOM_MODEL_PROVIDERS, type CustomModel, type CustomModelProvider, } from './models/custom-models.js';
|
|
22
22
|
export { getModelsDirectory, getModelFilePath, getModelDirectory, getModelStatePath, getModelTempDirectory, ensureModelsDirectory, ensureModelDirectory, modelFileExists, getModelFileSize, deleteModelDirectory, listModelDirectories, getModelsDiskUsage, formatSize, type ModelSource, type InstalledModel, type ModelState, loadModelState, saveModelState, addInstalledModel, removeInstalledModel, getInstalledModel, getAllInstalledModels, isModelInstalled, updateModelLastUsed, setActiveModel, getActiveModelId, getActiveModel, addToDownloadQueue, removeFromDownloadQueue, getDownloadQueue, syncStateWithFilesystem, getTotalInstalledSize, getInstalledModelCount, registerManualModel, } from './models/index.js';
|
|
23
|
+
export * from './runtime/index.js';
|
|
24
|
+
export * from './tool-provider/index.js';
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
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;AAClE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAG/E,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,YAAY,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EACH,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,KAAK,cAAc,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EAChB,KAAK,mBAAmB,GAC3B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEH,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EAEV,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(preferences_exports, {
|
|
|
25
25
|
PreferenceErrorCode: () => import_errors.PreferenceErrorCode,
|
|
26
26
|
PreferenceLLMSchema: () => import_schemas.PreferenceLLMSchema,
|
|
27
27
|
PreferenceSetupSchema: () => import_schemas.PreferenceSetupSchema,
|
|
28
|
+
PreferenceSoundsSchema: () => import_schemas.PreferenceSoundsSchema,
|
|
28
29
|
createInitialPreferences: () => import_loader.createInitialPreferences,
|
|
29
30
|
getGlobalPreferencesPath: () => import_loader.getGlobalPreferencesPath,
|
|
30
31
|
globalPreferencesExist: () => import_loader.globalPreferencesExist,
|
|
@@ -46,6 +47,7 @@ var import_errors = require("./errors.js");
|
|
|
46
47
|
PreferenceErrorCode,
|
|
47
48
|
PreferenceLLMSchema,
|
|
48
49
|
PreferenceSetupSchema,
|
|
50
|
+
PreferenceSoundsSchema,
|
|
49
51
|
createInitialPreferences,
|
|
50
52
|
getGlobalPreferencesPath,
|
|
51
53
|
globalPreferencesExist,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { GlobalPreferences, PreferenceLLM, PreferenceDefaults, PreferenceSetup, } from './schemas.js';
|
|
2
|
-
export { GlobalPreferencesSchema, PreferenceLLMSchema, PreferenceDefaultsSchema, PreferenceSetupSchema, } from './schemas.js';
|
|
1
|
+
export type { GlobalPreferences, PreferenceLLM, PreferenceDefaults, PreferenceSetup, PreferenceSounds, } from './schemas.js';
|
|
2
|
+
export { GlobalPreferencesSchema, PreferenceLLMSchema, PreferenceDefaultsSchema, PreferenceSetupSchema, PreferenceSoundsSchema, } from './schemas.js';
|
|
3
3
|
export { PREFERENCES_FILE } from './constants.js';
|
|
4
4
|
export { loadGlobalPreferences, saveGlobalPreferences, globalPreferencesExist, getGlobalPreferencesPath, createInitialPreferences, updateGlobalPreferences, type CreatePreferencesOptions, } from './loader.js';
|
|
5
5
|
export { PreferenceError, PreferenceErrorCode } from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preferences/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACR,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preferences/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACR,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,wBAAwB,GAChC,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
GlobalPreferencesSchema,
|
|
3
3
|
PreferenceLLMSchema,
|
|
4
4
|
PreferenceDefaultsSchema,
|
|
5
|
-
PreferenceSetupSchema
|
|
5
|
+
PreferenceSetupSchema,
|
|
6
|
+
PreferenceSoundsSchema
|
|
6
7
|
} from "./schemas.js";
|
|
7
8
|
import { PREFERENCES_FILE } from "./constants.js";
|
|
8
9
|
import {
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
PreferenceErrorCode,
|
|
23
24
|
PreferenceLLMSchema,
|
|
24
25
|
PreferenceSetupSchema,
|
|
26
|
+
PreferenceSoundsSchema,
|
|
25
27
|
createInitialPreferences,
|
|
26
28
|
getGlobalPreferencesPath,
|
|
27
29
|
globalPreferencesExist,
|
|
@@ -59,6 +59,17 @@ async function loadGlobalPreferences() {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
const PREFERENCES_FILE_HEADER = `# Dexto Global Preferences
|
|
63
|
+
# Documentation: https://dexto.dev/docs/configuration/preferences
|
|
64
|
+
#
|
|
65
|
+
# Sound Notifications:
|
|
66
|
+
# Dexto plays sounds for approval requests and task completion.
|
|
67
|
+
# To customize sounds, place audio files in ~/.dexto/sounds/:
|
|
68
|
+
# - approval.wav (or .mp3, .ogg, .aiff, .m4a) - played when tool approval is needed
|
|
69
|
+
# - complete.wav (or .mp3, .ogg, .aiff, .m4a) - played when agent finishes a task
|
|
70
|
+
# Set sounds.enabled: false to disable all sounds.
|
|
71
|
+
|
|
72
|
+
`;
|
|
62
73
|
async function saveGlobalPreferences(preferences) {
|
|
63
74
|
const preferencesPath = (0, import_path.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
64
75
|
const validation = import_schemas.GlobalPreferencesSchema.safeParse(preferences);
|
|
@@ -74,7 +85,7 @@ async function saveGlobalPreferences(preferences) {
|
|
|
74
85
|
lineWidth: 100,
|
|
75
86
|
minContentWidth: 20
|
|
76
87
|
});
|
|
77
|
-
await import_fs2.promises.writeFile(preferencesPath, yamlContent, "utf-8");
|
|
88
|
+
await import_fs2.promises.writeFile(preferencesPath, PREFERENCES_FILE_HEADER + yamlContent, "utf-8");
|
|
78
89
|
import_core.logger.debug(
|
|
79
90
|
`\u2713 Saved global preferences ${JSON.stringify(preferences)} to: ${preferencesPath}`
|
|
80
91
|
);
|
|
@@ -92,49 +103,35 @@ function globalPreferencesExist() {
|
|
|
92
103
|
function getGlobalPreferencesPath() {
|
|
93
104
|
return (0, import_path.getDextoGlobalPath)(import_constants.PREFERENCES_FILE);
|
|
94
105
|
}
|
|
95
|
-
function createInitialPreferences(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (opts.reasoningEffort) {
|
|
109
|
-
llmConfig.reasoningEffort = opts.reasoningEffort;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
llm: llmConfig,
|
|
113
|
-
defaults: {
|
|
114
|
-
defaultAgent: opts.defaultAgent || "coding-agent",
|
|
115
|
-
defaultMode: opts.defaultMode || "web"
|
|
116
|
-
},
|
|
117
|
-
setup: {
|
|
118
|
-
completed: opts.setupCompleted ?? true,
|
|
119
|
-
apiKeyPending: opts.apiKeyPending ?? false,
|
|
120
|
-
baseURLPending: opts.baseURLPending ?? false
|
|
121
|
-
}
|
|
122
|
-
};
|
|
106
|
+
function createInitialPreferences(options) {
|
|
107
|
+
const llmConfig = {
|
|
108
|
+
provider: options.provider,
|
|
109
|
+
model: options.model
|
|
110
|
+
};
|
|
111
|
+
if (options.apiKeyVar) {
|
|
112
|
+
llmConfig.apiKey = "$" + options.apiKeyVar;
|
|
113
|
+
}
|
|
114
|
+
if (options.baseURL) {
|
|
115
|
+
llmConfig.baseURL = options.baseURL;
|
|
116
|
+
}
|
|
117
|
+
if (options.reasoningEffort) {
|
|
118
|
+
llmConfig.reasoningEffort = options.reasoningEffort;
|
|
123
119
|
}
|
|
124
120
|
return {
|
|
125
|
-
llm:
|
|
126
|
-
provider: providerOrOptions,
|
|
127
|
-
model,
|
|
128
|
-
apiKey: `$${apiKeyVar}`
|
|
129
|
-
},
|
|
121
|
+
llm: llmConfig,
|
|
130
122
|
defaults: {
|
|
131
|
-
defaultAgent,
|
|
132
|
-
defaultMode: "web"
|
|
123
|
+
defaultAgent: options.defaultAgent || "coding-agent",
|
|
124
|
+
defaultMode: options.defaultMode || "web"
|
|
133
125
|
},
|
|
134
126
|
setup: {
|
|
135
|
-
completed: true,
|
|
136
|
-
apiKeyPending: false,
|
|
137
|
-
baseURLPending: false
|
|
127
|
+
completed: options.setupCompleted ?? true,
|
|
128
|
+
apiKeyPending: options.apiKeyPending ?? false,
|
|
129
|
+
baseURLPending: options.baseURLPending ?? false
|
|
130
|
+
},
|
|
131
|
+
sounds: {
|
|
132
|
+
enabled: options.sounds?.enabled ?? true,
|
|
133
|
+
onApprovalRequired: options.sounds?.onApprovalRequired ?? true,
|
|
134
|
+
onTaskComplete: options.sounds?.onTaskComplete ?? true
|
|
138
135
|
}
|
|
139
136
|
};
|
|
140
137
|
}
|
|
@@ -145,9 +142,10 @@ async function updateGlobalPreferences(updates) {
|
|
|
145
142
|
...updates,
|
|
146
143
|
// LLM section requires complete replacement (high coherence - provider/model/apiKey must match)
|
|
147
144
|
llm: updates.llm || existing.llm,
|
|
148
|
-
// Defaults and
|
|
145
|
+
// Defaults, setup, and sounds sections allow partial updates (low coherence - independent fields)
|
|
149
146
|
defaults: updates.defaults ? { ...existing.defaults, ...updates.defaults } : existing.defaults,
|
|
150
|
-
setup: updates.setup ? { ...existing.setup, ...updates.setup } : existing.setup
|
|
147
|
+
setup: updates.setup ? { ...existing.setup, ...updates.setup } : existing.setup,
|
|
148
|
+
sounds: updates.sounds ? { ...existing.sounds, ...updates.sounds } : existing.sounds
|
|
151
149
|
};
|
|
152
150
|
const validation = import_schemas.GlobalPreferencesSchema.safeParse(merged);
|
|
153
151
|
if (!validation.success) {
|
|
@@ -41,17 +41,18 @@ export interface CreatePreferencesOptions {
|
|
|
41
41
|
apiKeyPending?: boolean;
|
|
42
42
|
/** Whether baseURL setup was skipped and needs to be configured later */
|
|
43
43
|
baseURLPending?: boolean;
|
|
44
|
+
/** Sound notification preferences */
|
|
45
|
+
sounds?: {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
onApprovalRequired?: boolean;
|
|
48
|
+
onTaskComplete?: boolean;
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* Create initial preferences from setup data
|
|
47
53
|
* @param options Configuration options for preferences
|
|
48
54
|
*/
|
|
49
55
|
export declare function createInitialPreferences(options: CreatePreferencesOptions): GlobalPreferences;
|
|
50
|
-
/**
|
|
51
|
-
* Create initial preferences from setup data (legacy signature)
|
|
52
|
-
* @deprecated Use options object instead
|
|
53
|
-
*/
|
|
54
|
-
export declare function createInitialPreferences(provider: LLMProvider, model: string, apiKeyVar: string, defaultAgent?: string): GlobalPreferences;
|
|
55
56
|
/**
|
|
56
57
|
* Updates type that allows partial nested objects
|
|
57
58
|
*/
|
|
@@ -59,6 +60,7 @@ export type GlobalPreferencesUpdates = {
|
|
|
59
60
|
llm?: GlobalPreferences['llm'];
|
|
60
61
|
defaults?: Partial<GlobalPreferences['defaults']>;
|
|
61
62
|
setup?: Partial<GlobalPreferences['setup']>;
|
|
63
|
+
sounds?: Partial<GlobalPreferences['sounds']>;
|
|
62
64
|
};
|
|
63
65
|
/**
|
|
64
66
|
* Update specific preference sections
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/preferences/loader.ts"],"names":[],"mappings":"AAQA,OAAO,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CAAC;IACzB,qCAAqC;IACrC,MAAM,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;CACL;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,CAsC7F;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,GAAG,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,iBAAiB,CAAC,CA4B5B"}
|
|
@@ -31,6 +31,17 @@ async function loadGlobalPreferences() {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
const PREFERENCES_FILE_HEADER = `# Dexto Global Preferences
|
|
35
|
+
# Documentation: https://dexto.dev/docs/configuration/preferences
|
|
36
|
+
#
|
|
37
|
+
# Sound Notifications:
|
|
38
|
+
# Dexto plays sounds for approval requests and task completion.
|
|
39
|
+
# To customize sounds, place audio files in ~/.dexto/sounds/:
|
|
40
|
+
# - approval.wav (or .mp3, .ogg, .aiff, .m4a) - played when tool approval is needed
|
|
41
|
+
# - complete.wav (or .mp3, .ogg, .aiff, .m4a) - played when agent finishes a task
|
|
42
|
+
# Set sounds.enabled: false to disable all sounds.
|
|
43
|
+
|
|
44
|
+
`;
|
|
34
45
|
async function saveGlobalPreferences(preferences) {
|
|
35
46
|
const preferencesPath = getDextoGlobalPath(PREFERENCES_FILE);
|
|
36
47
|
const validation = GlobalPreferencesSchema.safeParse(preferences);
|
|
@@ -46,7 +57,7 @@ async function saveGlobalPreferences(preferences) {
|
|
|
46
57
|
lineWidth: 100,
|
|
47
58
|
minContentWidth: 20
|
|
48
59
|
});
|
|
49
|
-
await fs.writeFile(preferencesPath, yamlContent, "utf-8");
|
|
60
|
+
await fs.writeFile(preferencesPath, PREFERENCES_FILE_HEADER + yamlContent, "utf-8");
|
|
50
61
|
logger.debug(
|
|
51
62
|
`\u2713 Saved global preferences ${JSON.stringify(preferences)} to: ${preferencesPath}`
|
|
52
63
|
);
|
|
@@ -64,49 +75,35 @@ function globalPreferencesExist() {
|
|
|
64
75
|
function getGlobalPreferencesPath() {
|
|
65
76
|
return getDextoGlobalPath(PREFERENCES_FILE);
|
|
66
77
|
}
|
|
67
|
-
function createInitialPreferences(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (opts.reasoningEffort) {
|
|
81
|
-
llmConfig.reasoningEffort = opts.reasoningEffort;
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
llm: llmConfig,
|
|
85
|
-
defaults: {
|
|
86
|
-
defaultAgent: opts.defaultAgent || "coding-agent",
|
|
87
|
-
defaultMode: opts.defaultMode || "web"
|
|
88
|
-
},
|
|
89
|
-
setup: {
|
|
90
|
-
completed: opts.setupCompleted ?? true,
|
|
91
|
-
apiKeyPending: opts.apiKeyPending ?? false,
|
|
92
|
-
baseURLPending: opts.baseURLPending ?? false
|
|
93
|
-
}
|
|
94
|
-
};
|
|
78
|
+
function createInitialPreferences(options) {
|
|
79
|
+
const llmConfig = {
|
|
80
|
+
provider: options.provider,
|
|
81
|
+
model: options.model
|
|
82
|
+
};
|
|
83
|
+
if (options.apiKeyVar) {
|
|
84
|
+
llmConfig.apiKey = "$" + options.apiKeyVar;
|
|
85
|
+
}
|
|
86
|
+
if (options.baseURL) {
|
|
87
|
+
llmConfig.baseURL = options.baseURL;
|
|
88
|
+
}
|
|
89
|
+
if (options.reasoningEffort) {
|
|
90
|
+
llmConfig.reasoningEffort = options.reasoningEffort;
|
|
95
91
|
}
|
|
96
92
|
return {
|
|
97
|
-
llm:
|
|
98
|
-
provider: providerOrOptions,
|
|
99
|
-
model,
|
|
100
|
-
apiKey: `$${apiKeyVar}`
|
|
101
|
-
},
|
|
93
|
+
llm: llmConfig,
|
|
102
94
|
defaults: {
|
|
103
|
-
defaultAgent,
|
|
104
|
-
defaultMode: "web"
|
|
95
|
+
defaultAgent: options.defaultAgent || "coding-agent",
|
|
96
|
+
defaultMode: options.defaultMode || "web"
|
|
105
97
|
},
|
|
106
98
|
setup: {
|
|
107
|
-
completed: true,
|
|
108
|
-
apiKeyPending: false,
|
|
109
|
-
baseURLPending: false
|
|
99
|
+
completed: options.setupCompleted ?? true,
|
|
100
|
+
apiKeyPending: options.apiKeyPending ?? false,
|
|
101
|
+
baseURLPending: options.baseURLPending ?? false
|
|
102
|
+
},
|
|
103
|
+
sounds: {
|
|
104
|
+
enabled: options.sounds?.enabled ?? true,
|
|
105
|
+
onApprovalRequired: options.sounds?.onApprovalRequired ?? true,
|
|
106
|
+
onTaskComplete: options.sounds?.onTaskComplete ?? true
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
109
|
}
|
|
@@ -117,9 +114,10 @@ async function updateGlobalPreferences(updates) {
|
|
|
117
114
|
...updates,
|
|
118
115
|
// LLM section requires complete replacement (high coherence - provider/model/apiKey must match)
|
|
119
116
|
llm: updates.llm || existing.llm,
|
|
120
|
-
// Defaults and
|
|
117
|
+
// Defaults, setup, and sounds sections allow partial updates (low coherence - independent fields)
|
|
121
118
|
defaults: updates.defaults ? { ...existing.defaults, ...updates.defaults } : existing.defaults,
|
|
122
|
-
setup: updates.setup ? { ...existing.setup, ...updates.setup } : existing.setup
|
|
119
|
+
setup: updates.setup ? { ...existing.setup, ...updates.setup } : existing.setup,
|
|
120
|
+
sounds: updates.sounds ? { ...existing.sounds, ...updates.sounds } : existing.sounds
|
|
123
121
|
};
|
|
124
122
|
const validation = GlobalPreferencesSchema.safeParse(merged);
|
|
125
123
|
if (!validation.success) {
|
|
@@ -21,7 +21,8 @@ __export(schemas_exports, {
|
|
|
21
21
|
GlobalPreferencesSchema: () => GlobalPreferencesSchema,
|
|
22
22
|
PreferenceDefaultsSchema: () => PreferenceDefaultsSchema,
|
|
23
23
|
PreferenceLLMSchema: () => PreferenceLLMSchema,
|
|
24
|
-
PreferenceSetupSchema: () => PreferenceSetupSchema
|
|
24
|
+
PreferenceSetupSchema: () => PreferenceSetupSchema,
|
|
25
|
+
PreferenceSoundsSchema: () => PreferenceSoundsSchema
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(schemas_exports);
|
|
27
28
|
var import_zod = require("zod");
|
|
@@ -80,11 +81,21 @@ const PreferenceSetupSchema = import_zod.z.object({
|
|
|
80
81
|
apiKeyPending: import_zod.z.boolean().default(false).describe("Whether API key setup was skipped and needs to be configured later"),
|
|
81
82
|
baseURLPending: import_zod.z.boolean().default(false).describe("Whether baseURL setup was skipped and needs to be configured later")
|
|
82
83
|
}).strict();
|
|
84
|
+
const PreferenceSoundsSchema = import_zod.z.object({
|
|
85
|
+
enabled: import_zod.z.boolean().default(true).describe("Enable sound notifications (default: true)"),
|
|
86
|
+
onApprovalRequired: import_zod.z.boolean().default(true).describe(
|
|
87
|
+
"Play sound when tool approval is required (default: true when sounds enabled)"
|
|
88
|
+
),
|
|
89
|
+
onTaskComplete: import_zod.z.boolean().default(true).describe("Play sound when agent task completes (default: true when sounds enabled)")
|
|
90
|
+
}).strict();
|
|
83
91
|
const GlobalPreferencesSchema = import_zod.z.object({
|
|
84
92
|
llm: PreferenceLLMSchema.describe("LLM configuration preferences"),
|
|
85
93
|
defaults: PreferenceDefaultsSchema.describe("Default behavior preferences (required)"),
|
|
86
94
|
setup: PreferenceSetupSchema.default({ completed: false }).describe(
|
|
87
95
|
"Setup completion tracking"
|
|
96
|
+
),
|
|
97
|
+
sounds: PreferenceSoundsSchema.default({}).describe(
|
|
98
|
+
"Sound notification preferences (defaults applied for legacy preferences)"
|
|
88
99
|
)
|
|
89
100
|
}).strict();
|
|
90
101
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -92,5 +103,6 @@ const GlobalPreferencesSchema = import_zod.z.object({
|
|
|
92
103
|
GlobalPreferencesSchema,
|
|
93
104
|
PreferenceDefaultsSchema,
|
|
94
105
|
PreferenceLLMSchema,
|
|
95
|
-
PreferenceSetupSchema
|
|
106
|
+
PreferenceSetupSchema,
|
|
107
|
+
PreferenceSoundsSchema
|
|
96
108
|
});
|