@dexto/agent-management 1.2.6 → 1.4.0

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.
Files changed (53) hide show
  1. package/dist/AgentFactory.cjs +153 -0
  2. package/dist/AgentFactory.d.ts +121 -0
  3. package/dist/AgentFactory.d.ts.map +1 -0
  4. package/dist/AgentFactory.js +133 -0
  5. package/dist/AgentManager.cjs +226 -0
  6. package/dist/AgentManager.d.ts +191 -0
  7. package/dist/AgentManager.d.ts.map +1 -0
  8. package/dist/AgentManager.js +192 -0
  9. package/dist/config/config-enrichment.cjs +22 -2
  10. package/dist/config/config-enrichment.d.ts +19 -4
  11. package/dist/config/config-enrichment.d.ts.map +1 -1
  12. package/dist/config/config-enrichment.js +21 -2
  13. package/dist/config/config-manager.cjs +340 -3
  14. package/dist/config/config-manager.d.ts +158 -7
  15. package/dist/config/config-manager.d.ts.map +1 -1
  16. package/dist/config/config-manager.js +325 -3
  17. package/dist/config/discover-prompts.cjs +103 -0
  18. package/dist/config/discover-prompts.d.ts +28 -0
  19. package/dist/config/discover-prompts.d.ts.map +1 -0
  20. package/dist/config/discover-prompts.js +73 -0
  21. package/dist/config/index.cjs +14 -2
  22. package/dist/config/index.d.ts +2 -2
  23. package/dist/config/index.d.ts.map +1 -1
  24. package/dist/config/index.js +21 -3
  25. package/dist/index.cjs +40 -6
  26. package/dist/index.d.ts +6 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +40 -5
  29. package/dist/installation.cjs +252 -0
  30. package/dist/installation.d.ts +74 -0
  31. package/dist/installation.d.ts.map +1 -0
  32. package/dist/installation.js +215 -0
  33. package/dist/models/custom-models.cjs +116 -0
  34. package/dist/models/custom-models.d.ts +51 -0
  35. package/dist/models/custom-models.d.ts.map +1 -0
  36. package/dist/models/custom-models.js +77 -0
  37. package/dist/registry/registry.cjs +21 -2
  38. package/dist/registry/registry.d.ts +5 -0
  39. package/dist/registry/registry.d.ts.map +1 -1
  40. package/dist/registry/registry.js +19 -1
  41. package/dist/registry/types.d.ts +9 -9
  42. package/dist/resolver.cjs +68 -29
  43. package/dist/resolver.d.ts +6 -3
  44. package/dist/resolver.d.ts.map +1 -1
  45. package/dist/resolver.js +69 -30
  46. package/dist/writer.cjs +15 -13
  47. package/dist/writer.d.ts.map +1 -1
  48. package/dist/writer.js +16 -14
  49. package/package.json +2 -2
  50. package/dist/AgentOrchestrator.cjs +0 -263
  51. package/dist/AgentOrchestrator.d.ts +0 -191
  52. package/dist/AgentOrchestrator.d.ts.map +0 -1
  53. package/dist/AgentOrchestrator.js +0 -239
package/dist/index.cjs CHANGED
@@ -18,17 +18,21 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var index_exports = {};
20
20
  __export(index_exports, {
21
- AgentOrchestrator: () => import_AgentOrchestrator.AgentOrchestrator,
21
+ AgentFactory: () => import_AgentFactory.AgentFactory,
22
+ AgentManager: () => import_AgentManager.AgentManager,
22
23
  ConfigError: () => import_config.ConfigError,
23
24
  ConfigErrorCode: () => import_config.ConfigErrorCode,
24
- Dexto: () => import_AgentOrchestrator2.AgentOrchestrator,
25
+ CustomModelSchema: () => import_custom_models.CustomModelSchema,
25
26
  PROVIDER_API_KEY_MAP: () => import_api_key_resolver.PROVIDER_API_KEY_MAP,
26
27
  PreferenceError: () => import_errors2.PreferenceError,
27
28
  PreferenceErrorCode: () => import_errors2.PreferenceErrorCode,
28
29
  RegistryError: () => import_errors.RegistryError,
29
30
  RegistryErrorCode: () => import_error_codes.RegistryErrorCode,
31
+ addPromptToAgentConfig: () => import_config.addPromptToAgentConfig,
30
32
  copyDirectory: () => import_path.copyDirectory,
31
33
  createInitialPreferences: () => import_loader.createInitialPreferences,
34
+ deleteCustomModel: () => import_custom_models.deleteCustomModel,
35
+ deletePromptByMetadata: () => import_config.deletePromptByMetadata,
32
36
  deriveAgentId: () => import_config.deriveAgentId,
33
37
  deriveDisplayName: () => import_types.deriveDisplayName,
34
38
  enrichAgentConfig: () => import_config.enrichAgentConfig,
@@ -37,6 +41,8 @@ __export(index_exports, {
37
41
  findDextoSourceRoot: () => import_execution_context.findDextoSourceRoot,
38
42
  findPackageRoot: () => import_path.findPackageRoot,
39
43
  getAgentRegistry: () => import_registry.getAgentRegistry,
44
+ getCustomModel: () => import_custom_models.getCustomModel,
45
+ getCustomModelsPath: () => import_custom_models.getCustomModelsPath,
40
46
  getDextoEnvPath: () => import_path.getDextoEnvPath,
41
47
  getDextoGlobalPath: () => import_path.getDextoGlobalPath,
42
48
  getDextoPath: () => import_path.getDextoPath,
@@ -45,20 +51,30 @@ __export(index_exports, {
45
51
  getPrimaryApiKeyEnvVar: () => import_api_key_resolver.getPrimaryApiKeyEnvVar,
46
52
  getProviderKeyStatus: () => import_api_key_store.getProviderKeyStatus,
47
53
  globalPreferencesExist: () => import_loader.globalPreferencesExist,
54
+ installBundledAgent: () => import_installation.installBundledAgent,
55
+ installCustomAgent: () => import_installation.installCustomAgent,
48
56
  isPath: () => import_path.isPath,
57
+ listInstalledAgents: () => import_installation.listInstalledAgents,
49
58
  listProviderKeyStatus: () => import_api_key_store.listProviderKeyStatus,
50
59
  loadAgentConfig: () => import_config.loadAgentConfig,
60
+ loadBundledRegistryAgents: () => import_registry.loadBundledRegistryAgents,
61
+ loadCustomModels: () => import_custom_models.loadCustomModels,
51
62
  loadGlobalPreferences: () => import_loader.loadGlobalPreferences,
52
63
  reloadAgentConfigFromFile: () => import_config.reloadAgentConfigFromFile,
64
+ removeMcpServerFromConfig: () => import_config.removeMcpServerFromConfig,
65
+ removePromptFromAgentConfig: () => import_config.removePromptFromAgentConfig,
53
66
  resolveAgentPath: () => import_resolver.resolveAgentPath,
54
67
  resolveApiKeyForProvider: () => import_api_key_resolver.resolveApiKeyForProvider,
55
68
  resolveBundledScript: () => import_path.resolveBundledScript,
69
+ saveCustomModel: () => import_custom_models.saveCustomModel,
56
70
  saveGlobalPreferences: () => import_loader.saveGlobalPreferences,
57
71
  saveProviderApiKey: () => import_api_key_store.saveProviderApiKey,
72
+ uninstallAgent: () => import_installation.uninstallAgent,
58
73
  updateAgentConfigFile: () => import_config.updateAgentConfigFile,
59
74
  updateDefaultAgentPreference: () => import_resolver.updateDefaultAgentPreference,
60
75
  updateEnvFile: () => import_env_file.updateEnvFile,
61
76
  updateGlobalPreferences: () => import_loader.updateGlobalPreferences,
77
+ updateMcpServerField: () => import_config.updateMcpServerField,
62
78
  walkUpDirectories: () => import_fs_walk.walkUpDirectories,
63
79
  writeConfigFile: () => import_writer.writeConfigFile,
64
80
  writeLLMPreferences: () => import_writer.writeLLMPreferences,
@@ -73,8 +89,9 @@ var import_loader = require("./preferences/loader.js");
73
89
  var import_errors2 = require("./preferences/errors.js");
74
90
  var import_resolver = require("./resolver.js");
75
91
  var import_writer = require("./writer.js");
76
- var import_AgentOrchestrator = require("./AgentOrchestrator.js");
77
- var import_AgentOrchestrator2 = require("./AgentOrchestrator.js");
92
+ var import_AgentManager = require("./AgentManager.js");
93
+ var import_installation = require("./installation.js");
94
+ var import_AgentFactory = require("./AgentFactory.js");
78
95
  var import_path = require("./utils/path.js");
79
96
  var import_execution_context = require("./utils/execution-context.js");
80
97
  var import_fs_walk = require("./utils/fs-walk.js");
@@ -82,19 +99,24 @@ var import_env_file = require("./utils/env-file.js");
82
99
  var import_config = require("./config/index.js");
83
100
  var import_api_key_store = require("./utils/api-key-store.js");
84
101
  var import_api_key_resolver = require("./utils/api-key-resolver.js");
102
+ var import_custom_models = require("./models/custom-models.js");
85
103
  // Annotate the CommonJS export names for ESM import in node:
86
104
  0 && (module.exports = {
87
- AgentOrchestrator,
105
+ AgentFactory,
106
+ AgentManager,
88
107
  ConfigError,
89
108
  ConfigErrorCode,
90
- Dexto,
109
+ CustomModelSchema,
91
110
  PROVIDER_API_KEY_MAP,
92
111
  PreferenceError,
93
112
  PreferenceErrorCode,
94
113
  RegistryError,
95
114
  RegistryErrorCode,
115
+ addPromptToAgentConfig,
96
116
  copyDirectory,
97
117
  createInitialPreferences,
118
+ deleteCustomModel,
119
+ deletePromptByMetadata,
98
120
  deriveAgentId,
99
121
  deriveDisplayName,
100
122
  enrichAgentConfig,
@@ -103,6 +125,8 @@ var import_api_key_resolver = require("./utils/api-key-resolver.js");
103
125
  findDextoSourceRoot,
104
126
  findPackageRoot,
105
127
  getAgentRegistry,
128
+ getCustomModel,
129
+ getCustomModelsPath,
106
130
  getDextoEnvPath,
107
131
  getDextoGlobalPath,
108
132
  getDextoPath,
@@ -111,20 +135,30 @@ var import_api_key_resolver = require("./utils/api-key-resolver.js");
111
135
  getPrimaryApiKeyEnvVar,
112
136
  getProviderKeyStatus,
113
137
  globalPreferencesExist,
138
+ installBundledAgent,
139
+ installCustomAgent,
114
140
  isPath,
141
+ listInstalledAgents,
115
142
  listProviderKeyStatus,
116
143
  loadAgentConfig,
144
+ loadBundledRegistryAgents,
145
+ loadCustomModels,
117
146
  loadGlobalPreferences,
118
147
  reloadAgentConfigFromFile,
148
+ removeMcpServerFromConfig,
149
+ removePromptFromAgentConfig,
119
150
  resolveAgentPath,
120
151
  resolveApiKeyForProvider,
121
152
  resolveBundledScript,
153
+ saveCustomModel,
122
154
  saveGlobalPreferences,
123
155
  saveProviderApiKey,
156
+ uninstallAgent,
124
157
  updateAgentConfigFile,
125
158
  updateDefaultAgentPreference,
126
159
  updateEnvFile,
127
160
  updateGlobalPreferences,
161
+ updateMcpServerField,
128
162
  walkUpDirectories,
129
163
  writeConfigFile,
130
164
  writeLLMPreferences,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { getAgentRegistry } from './registry/registry.js';
1
+ export { getAgentRegistry, loadBundledRegistryAgents } from './registry/registry.js';
2
2
  export type { AgentRegistry, AgentRegistryEntry, Registry } from './registry/types.js';
3
3
  export { deriveDisplayName } from './registry/types.js';
4
4
  export { RegistryError } from './registry/errors.js';
@@ -8,13 +8,15 @@ export type { GlobalPreferences } from './preferences/schemas.js';
8
8
  export { PreferenceError, PreferenceErrorCode } from './preferences/errors.js';
9
9
  export { resolveAgentPath, updateDefaultAgentPreference } from './resolver.js';
10
10
  export { writeConfigFile, writeLLMPreferences, writePreferencesToAgent, type LLMOverrides, } from './writer.js';
11
- export { AgentOrchestrator } from './AgentOrchestrator.js';
12
- export { AgentOrchestrator as Dexto } from './AgentOrchestrator.js';
11
+ export { AgentManager, type AgentMetadata } from './AgentManager.js';
12
+ export { installBundledAgent, installCustomAgent, uninstallAgent, listInstalledAgents, type InstallOptions, } from './installation.js';
13
+ export { AgentFactory, type CreateAgentOptions } from './AgentFactory.js';
13
14
  export { getDextoPath, getDextoGlobalPath, getDextoEnvPath, copyDirectory, isPath, findPackageRoot, resolveBundledScript, ensureDextoGlobalDirectory, } from './utils/path.js';
14
15
  export { getExecutionContext, findDextoSourceRoot, findDextoProjectRoot, type ExecutionContext, } from './utils/execution-context.js';
15
16
  export { walkUpDirectories } from './utils/fs-walk.js';
16
17
  export { updateEnvFile } from './utils/env-file.js';
17
- export { updateAgentConfigFile, reloadAgentConfigFromFile, loadAgentConfig, enrichAgentConfig, deriveAgentId, ConfigError, ConfigErrorCode, } from './config/index.js';
18
+ export { updateAgentConfigFile, reloadAgentConfigFromFile, loadAgentConfig, enrichAgentConfig, deriveAgentId, addPromptToAgentConfig, removePromptFromAgentConfig, deletePromptByMetadata, updateMcpServerField, removeMcpServerFromConfig, ConfigError, ConfigErrorCode, type FilePromptInput, type InlinePromptInput, type PromptInput, type PromptMetadataForDeletion, type PromptDeletionResult, } from './config/index.js';
18
19
  export { saveProviderApiKey, getProviderKeyStatus, listProviderKeyStatus, } from './utils/api-key-store.js';
19
20
  export { resolveApiKeyForProvider, getPrimaryApiKeyEnvVar, PROVIDER_API_KEY_MAP, } from './utils/api-key-resolver.js';
21
+ export { loadCustomModels, saveCustomModel, deleteCustomModel, getCustomModel, getCustomModelsPath, CustomModelSchema, type CustomModel, } from './models/custom-models.js';
20
22
  //# sourceMappingURL=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c,EACd,mBAAmB,EACnB,KAAK,cAAc,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EACH,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,0BAA0B,GAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,gBAAgB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,EACX,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,GAC5B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACH,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,GACvB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,WAAW,GACnB,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getAgentRegistry } from "./registry/registry.js";
1
+ import { getAgentRegistry, loadBundledRegistryAgents } from "./registry/registry.js";
2
2
  import { deriveDisplayName } from "./registry/types.js";
3
3
  import { RegistryError } from "./registry/errors.js";
4
4
  import { RegistryErrorCode } from "./registry/error-codes.js";
@@ -17,8 +17,14 @@ import {
17
17
  writeLLMPreferences,
18
18
  writePreferencesToAgent
19
19
  } from "./writer.js";
20
- import { AgentOrchestrator } from "./AgentOrchestrator.js";
21
- import { AgentOrchestrator as AgentOrchestrator2 } from "./AgentOrchestrator.js";
20
+ import { AgentManager } from "./AgentManager.js";
21
+ import {
22
+ installBundledAgent,
23
+ installCustomAgent,
24
+ uninstallAgent,
25
+ listInstalledAgents
26
+ } from "./installation.js";
27
+ import { AgentFactory } from "./AgentFactory.js";
22
28
  import {
23
29
  getDextoPath,
24
30
  getDextoGlobalPath,
@@ -42,6 +48,11 @@ import {
42
48
  loadAgentConfig,
43
49
  enrichAgentConfig,
44
50
  deriveAgentId,
51
+ addPromptToAgentConfig,
52
+ removePromptFromAgentConfig,
53
+ deletePromptByMetadata,
54
+ updateMcpServerField,
55
+ removeMcpServerFromConfig,
45
56
  ConfigError,
46
57
  ConfigErrorCode
47
58
  } from "./config/index.js";
@@ -55,18 +66,30 @@ import {
55
66
  getPrimaryApiKeyEnvVar,
56
67
  PROVIDER_API_KEY_MAP
57
68
  } from "./utils/api-key-resolver.js";
69
+ import {
70
+ loadCustomModels,
71
+ saveCustomModel,
72
+ deleteCustomModel,
73
+ getCustomModel,
74
+ getCustomModelsPath,
75
+ CustomModelSchema
76
+ } from "./models/custom-models.js";
58
77
  export {
59
- AgentOrchestrator,
78
+ AgentFactory,
79
+ AgentManager,
60
80
  ConfigError,
61
81
  ConfigErrorCode,
62
- AgentOrchestrator2 as Dexto,
82
+ CustomModelSchema,
63
83
  PROVIDER_API_KEY_MAP,
64
84
  PreferenceError,
65
85
  PreferenceErrorCode,
66
86
  RegistryError,
67
87
  RegistryErrorCode,
88
+ addPromptToAgentConfig,
68
89
  copyDirectory,
69
90
  createInitialPreferences,
91
+ deleteCustomModel,
92
+ deletePromptByMetadata,
70
93
  deriveAgentId,
71
94
  deriveDisplayName,
72
95
  enrichAgentConfig,
@@ -75,6 +98,8 @@ export {
75
98
  findDextoSourceRoot,
76
99
  findPackageRoot,
77
100
  getAgentRegistry,
101
+ getCustomModel,
102
+ getCustomModelsPath,
78
103
  getDextoEnvPath,
79
104
  getDextoGlobalPath,
80
105
  getDextoPath,
@@ -83,20 +108,30 @@ export {
83
108
  getPrimaryApiKeyEnvVar,
84
109
  getProviderKeyStatus,
85
110
  globalPreferencesExist,
111
+ installBundledAgent,
112
+ installCustomAgent,
86
113
  isPath,
114
+ listInstalledAgents,
87
115
  listProviderKeyStatus,
88
116
  loadAgentConfig,
117
+ loadBundledRegistryAgents,
118
+ loadCustomModels,
89
119
  loadGlobalPreferences,
90
120
  reloadAgentConfigFromFile,
121
+ removeMcpServerFromConfig,
122
+ removePromptFromAgentConfig,
91
123
  resolveAgentPath,
92
124
  resolveApiKeyForProvider,
93
125
  resolveBundledScript,
126
+ saveCustomModel,
94
127
  saveGlobalPreferences,
95
128
  saveProviderApiKey,
129
+ uninstallAgent,
96
130
  updateAgentConfigFile,
97
131
  updateDefaultAgentPreference,
98
132
  updateEnvFile,
99
133
  updateGlobalPreferences,
134
+ updateMcpServerField,
100
135
  walkUpDirectories,
101
136
  writeConfigFile,
102
137
  writeLLMPreferences,
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
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
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var installation_exports = {};
30
+ __export(installation_exports, {
31
+ installBundledAgent: () => installBundledAgent,
32
+ installCustomAgent: () => installCustomAgent,
33
+ listInstalledAgents: () => listInstalledAgents,
34
+ uninstallAgent: () => uninstallAgent
35
+ });
36
+ module.exports = __toCommonJS(installation_exports);
37
+ var import_fs = require("fs");
38
+ var import_path = __toESM(require("path"), 1);
39
+ var import_core = require("@dexto/core");
40
+ var import_path2 = require("./utils/path.js");
41
+ var import_loader = require("./preferences/loader.js");
42
+ var import_writer = require("./writer.js");
43
+ var import_errors = require("./registry/errors.js");
44
+ var import_errors2 = require("./config/errors.js");
45
+ function getAgentsDir(options) {
46
+ return options?.agentsDir ?? (0, import_path2.getDextoGlobalPath)("agents");
47
+ }
48
+ function getUserRegistryPath(agentsDir) {
49
+ return import_path.default.join(agentsDir, "registry.json");
50
+ }
51
+ async function loadUserRegistry(registryPath) {
52
+ try {
53
+ const content = await import_fs.promises.readFile(registryPath, "utf-8");
54
+ return JSON.parse(content);
55
+ } catch (error) {
56
+ if (error.code === "ENOENT") {
57
+ return { agents: [] };
58
+ }
59
+ throw error;
60
+ }
61
+ }
62
+ async function saveUserRegistry(registryPath, registry) {
63
+ await import_fs.promises.mkdir(import_path.default.dirname(registryPath), { recursive: true });
64
+ await import_fs.promises.writeFile(registryPath, JSON.stringify(registry, null, 2));
65
+ }
66
+ async function installBundledAgent(agentId, options) {
67
+ const agentsDir = getAgentsDir(options);
68
+ const bundledRegistryPath = (0, import_path2.resolveBundledScript)("agents/agent-registry.json");
69
+ import_core.logger.info(`Installing agent: ${agentId}`);
70
+ let bundledRegistry;
71
+ try {
72
+ const content = await import_fs.promises.readFile(bundledRegistryPath, "utf-8");
73
+ bundledRegistry = JSON.parse(content);
74
+ } catch (error) {
75
+ throw import_errors.RegistryError.registryParseError(
76
+ bundledRegistryPath,
77
+ error instanceof Error ? error.message : String(error)
78
+ );
79
+ }
80
+ const agentEntry = bundledRegistry.agents[agentId];
81
+ if (!agentEntry) {
82
+ const available = Object.keys(bundledRegistry.agents);
83
+ throw import_errors.RegistryError.agentNotFound(agentId, available);
84
+ }
85
+ const targetDir = import_path.default.join(agentsDir, agentId);
86
+ try {
87
+ await import_fs.promises.access(targetDir);
88
+ import_core.logger.info(`Agent '${agentId}' already installed`);
89
+ const mainFile = agentEntry.main || import_path.default.basename(agentEntry.source);
90
+ return import_path.default.join(targetDir, mainFile);
91
+ } catch {
92
+ }
93
+ await import_fs.promises.mkdir(agentsDir, { recursive: true });
94
+ const sourcePath = (0, import_path2.resolveBundledScript)(`agents/${agentEntry.source}`);
95
+ const tempDir = `${targetDir}.tmp.${Date.now()}`;
96
+ try {
97
+ if (agentEntry.source.endsWith("/")) {
98
+ await (0, import_path2.copyDirectory)(sourcePath, tempDir);
99
+ } else {
100
+ await import_fs.promises.mkdir(tempDir, { recursive: true });
101
+ const targetFile = import_path.default.join(tempDir, import_path.default.basename(sourcePath));
102
+ await import_fs.promises.copyFile(sourcePath, targetFile);
103
+ }
104
+ await import_fs.promises.rename(tempDir, targetDir);
105
+ import_core.logger.info(`\u2713 Installed agent '${agentId}' to ${targetDir}`);
106
+ if (options?.injectPreferences !== false) {
107
+ try {
108
+ const preferences = await (0, import_loader.loadGlobalPreferences)();
109
+ await (0, import_writer.writePreferencesToAgent)(targetDir, preferences);
110
+ import_core.logger.info(`\u2713 Applied global preferences to '${agentId}'`);
111
+ } catch (error) {
112
+ import_core.logger.warn(
113
+ `Failed to inject preferences: ${error instanceof Error ? error.message : String(error)}`
114
+ );
115
+ }
116
+ }
117
+ const userRegistryPath = getUserRegistryPath(agentsDir);
118
+ const userRegistry = await loadUserRegistry(userRegistryPath);
119
+ if (!userRegistry.agents.some((a) => a.id === agentId)) {
120
+ const mainFile = agentEntry.main || import_path.default.basename(agentEntry.source);
121
+ userRegistry.agents.push({
122
+ id: agentId,
123
+ name: agentEntry.name,
124
+ description: agentEntry.description,
125
+ configPath: `./${agentId}/${mainFile}`,
126
+ author: agentEntry.author,
127
+ tags: agentEntry.tags
128
+ });
129
+ await saveUserRegistry(userRegistryPath, userRegistry);
130
+ }
131
+ return import_path.default.join(targetDir, agentEntry.main || import_path.default.basename(agentEntry.source));
132
+ } catch (error) {
133
+ try {
134
+ await import_fs.promises.rm(tempDir, { recursive: true, force: true });
135
+ } catch {
136
+ }
137
+ throw import_errors.RegistryError.installationFailed(
138
+ agentId,
139
+ error instanceof Error ? error.message : String(error)
140
+ );
141
+ }
142
+ }
143
+ async function installCustomAgent(agentId, sourcePath, metadata, options) {
144
+ const agentsDir = getAgentsDir(options);
145
+ const targetDir = import_path.default.join(agentsDir, agentId);
146
+ import_core.logger.info(`Installing custom agent: ${agentId}`);
147
+ try {
148
+ const bundledRegistryPath = (0, import_path2.resolveBundledScript)("agents/agent-registry.json");
149
+ const bundledContent = await import_fs.promises.readFile(bundledRegistryPath, "utf-8");
150
+ const bundledRegistry = JSON.parse(bundledContent);
151
+ if (agentId in bundledRegistry.agents) {
152
+ throw import_errors.RegistryError.customAgentNameConflict(agentId);
153
+ }
154
+ } catch (error) {
155
+ if (error instanceof Error && error.message.includes("conflicts with builtin")) {
156
+ throw error;
157
+ }
158
+ import_core.logger.debug(
159
+ `Could not validate against bundled registry: ${error instanceof Error ? error.message : String(error)}`
160
+ );
161
+ }
162
+ try {
163
+ await import_fs.promises.access(targetDir);
164
+ throw import_errors.RegistryError.agentAlreadyExists(agentId);
165
+ } catch (error) {
166
+ if (error.code !== "ENOENT") {
167
+ throw error;
168
+ }
169
+ }
170
+ const resolvedSource = import_path.default.resolve(sourcePath);
171
+ let stat;
172
+ try {
173
+ stat = await import_fs.promises.stat(resolvedSource);
174
+ } catch (_error) {
175
+ throw import_errors2.ConfigError.fileNotFound(resolvedSource);
176
+ }
177
+ await import_fs.promises.mkdir(agentsDir, { recursive: true });
178
+ try {
179
+ if (stat.isDirectory()) {
180
+ await (0, import_path2.copyDirectory)(resolvedSource, targetDir);
181
+ } else {
182
+ await import_fs.promises.mkdir(targetDir, { recursive: true });
183
+ const filename = import_path.default.basename(resolvedSource);
184
+ await import_fs.promises.copyFile(resolvedSource, import_path.default.join(targetDir, filename));
185
+ }
186
+ import_core.logger.info(`\u2713 Installed custom agent '${agentId}' to ${targetDir}`);
187
+ const userRegistryPath = getUserRegistryPath(agentsDir);
188
+ const userRegistry = await loadUserRegistry(userRegistryPath);
189
+ const configFile = stat.isDirectory() ? "agent.yml" : import_path.default.basename(resolvedSource);
190
+ userRegistry.agents.push({
191
+ id: agentId,
192
+ name: metadata.name || agentId,
193
+ description: metadata.description,
194
+ configPath: `./${agentId}/${configFile}`,
195
+ author: metadata.author,
196
+ tags: metadata.tags || []
197
+ });
198
+ await saveUserRegistry(userRegistryPath, userRegistry);
199
+ return import_path.default.join(targetDir, configFile);
200
+ } catch (error) {
201
+ try {
202
+ await import_fs.promises.rm(targetDir, { recursive: true, force: true });
203
+ } catch {
204
+ }
205
+ throw import_errors.RegistryError.installationFailed(
206
+ agentId,
207
+ error instanceof Error ? error.message : String(error)
208
+ );
209
+ }
210
+ }
211
+ async function uninstallAgent(agentId, options) {
212
+ const agentsDir = getAgentsDir(options);
213
+ const targetDir = import_path.default.join(agentsDir, agentId);
214
+ import_core.logger.info(`Uninstalling agent: ${agentId}`);
215
+ try {
216
+ await import_fs.promises.access(targetDir);
217
+ } catch (_error) {
218
+ throw import_errors.RegistryError.agentNotInstalled(agentId);
219
+ }
220
+ await import_fs.promises.rm(targetDir, { recursive: true, force: true });
221
+ import_core.logger.info(`\u2713 Removed agent directory: ${targetDir}`);
222
+ const userRegistryPath = getUserRegistryPath(agentsDir);
223
+ try {
224
+ const userRegistry = await loadUserRegistry(userRegistryPath);
225
+ userRegistry.agents = userRegistry.agents.filter((a) => a.id !== agentId);
226
+ await saveUserRegistry(userRegistryPath, userRegistry);
227
+ import_core.logger.info(`\u2713 Removed '${agentId}' from user registry`);
228
+ } catch (error) {
229
+ import_core.logger.warn(
230
+ `Failed to update user registry: ${error instanceof Error ? error.message : String(error)}`
231
+ );
232
+ }
233
+ }
234
+ async function listInstalledAgents(options) {
235
+ const agentsDir = getAgentsDir(options);
236
+ try {
237
+ const entries = await import_fs.promises.readdir(agentsDir, { withFileTypes: true });
238
+ return entries.filter((e) => e.isDirectory()).map((e) => e.name);
239
+ } catch (error) {
240
+ if (error.code === "ENOENT") {
241
+ return [];
242
+ }
243
+ throw error;
244
+ }
245
+ }
246
+ // Annotate the CommonJS export names for ESM import in node:
247
+ 0 && (module.exports = {
248
+ installBundledAgent,
249
+ installCustomAgent,
250
+ listInstalledAgents,
251
+ uninstallAgent
252
+ });
@@ -0,0 +1,74 @@
1
+ import type { AgentMetadata } from './AgentManager.js';
2
+ export interface InstallOptions {
3
+ /** Directory where agents are stored (default: ~/.dexto/agents) */
4
+ agentsDir?: string;
5
+ /** Whether to inject global preferences into agent config (default: true) */
6
+ injectPreferences?: boolean;
7
+ }
8
+ /**
9
+ * Install agent from bundled registry to local directory
10
+ *
11
+ * @param agentId ID of the agent to install from bundled registry
12
+ * @param options Installation options
13
+ * @returns Path to the installed agent's main config file
14
+ *
15
+ * @throws {DextoRuntimeError} If agent not found in bundled registry or installation fails
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * await installBundledAgent('coding-agent');
20
+ * console.log('Agent installed to ~/.dexto/agents/coding-agent');
21
+ * ```
22
+ */
23
+ export declare function installBundledAgent(agentId: string, options?: InstallOptions): Promise<string>;
24
+ /**
25
+ * Install custom agent from local path
26
+ *
27
+ * @param agentId Unique ID for the custom agent
28
+ * @param sourcePath Absolute path to agent YAML file or directory
29
+ * @param metadata Agent metadata (name, description, author, tags)
30
+ * @param options Installation options
31
+ * @returns Path to the installed agent's main config file
32
+ *
33
+ * @throws {DextoRuntimeError} If agent ID already exists or installation fails
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * await installCustomAgent('my-agent', '/path/to/agent.yml', {
38
+ * name: 'My Agent',
39
+ * description: 'Custom agent for my use case',
40
+ * author: 'John Doe',
41
+ * tags: ['custom']
42
+ * });
43
+ * ```
44
+ */
45
+ export declare function installCustomAgent(agentId: string, sourcePath: string, metadata: Pick<AgentMetadata, 'name' | 'description' | 'author' | 'tags'>, options?: InstallOptions): Promise<string>;
46
+ /**
47
+ * Uninstall agent by removing it from disk and user registry
48
+ *
49
+ * @param agentId ID of the agent to uninstall
50
+ * @param options Installation options
51
+ *
52
+ * @throws {DextoRuntimeError} If agent not installed
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * await uninstallAgent('my-custom-agent');
57
+ * console.log('Agent uninstalled');
58
+ * ```
59
+ */
60
+ export declare function uninstallAgent(agentId: string, options?: InstallOptions): Promise<void>;
61
+ /**
62
+ * List installed agents
63
+ *
64
+ * @param options Installation options
65
+ * @returns Array of installed agent IDs
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const installed = await listInstalledAgents();
70
+ * console.log(installed); // ['coding-agent', 'my-custom-agent']
71
+ * ```
72
+ */
73
+ export declare function listInstalledAgents(options?: InstallOptions): Promise<string[]>;
74
+ //# sourceMappingURL=installation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../src/installation.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC3B,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAuCD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,mBAAmB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,MAAM,CAAC,CA0GjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,kBAAkB,CACpC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC,EACzE,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,MAAM,CAAC,CA2FjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYrF"}