@dexto/agent-management 1.3.0 → 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 (50) 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/package.json +2 -2
  47. package/dist/AgentOrchestrator.cjs +0 -263
  48. package/dist/AgentOrchestrator.d.ts +0 -191
  49. package/dist/AgentOrchestrator.d.ts.map +0 -1
  50. package/dist/AgentOrchestrator.js +0 -239
@@ -0,0 +1,215 @@
1
+ import { promises as fs } from "fs";
2
+ import path from "path";
3
+ import { logger } from "@dexto/core";
4
+ import { getDextoGlobalPath, resolveBundledScript, copyDirectory } from "./utils/path.js";
5
+ import { loadGlobalPreferences } from "./preferences/loader.js";
6
+ import { writePreferencesToAgent } from "./writer.js";
7
+ import { RegistryError } from "./registry/errors.js";
8
+ import { ConfigError } from "./config/errors.js";
9
+ function getAgentsDir(options) {
10
+ return options?.agentsDir ?? getDextoGlobalPath("agents");
11
+ }
12
+ function getUserRegistryPath(agentsDir) {
13
+ return path.join(agentsDir, "registry.json");
14
+ }
15
+ async function loadUserRegistry(registryPath) {
16
+ try {
17
+ const content = await fs.readFile(registryPath, "utf-8");
18
+ return JSON.parse(content);
19
+ } catch (error) {
20
+ if (error.code === "ENOENT") {
21
+ return { agents: [] };
22
+ }
23
+ throw error;
24
+ }
25
+ }
26
+ async function saveUserRegistry(registryPath, registry) {
27
+ await fs.mkdir(path.dirname(registryPath), { recursive: true });
28
+ await fs.writeFile(registryPath, JSON.stringify(registry, null, 2));
29
+ }
30
+ async function installBundledAgent(agentId, options) {
31
+ const agentsDir = getAgentsDir(options);
32
+ const bundledRegistryPath = resolveBundledScript("agents/agent-registry.json");
33
+ logger.info(`Installing agent: ${agentId}`);
34
+ let bundledRegistry;
35
+ try {
36
+ const content = await fs.readFile(bundledRegistryPath, "utf-8");
37
+ bundledRegistry = JSON.parse(content);
38
+ } catch (error) {
39
+ throw RegistryError.registryParseError(
40
+ bundledRegistryPath,
41
+ error instanceof Error ? error.message : String(error)
42
+ );
43
+ }
44
+ const agentEntry = bundledRegistry.agents[agentId];
45
+ if (!agentEntry) {
46
+ const available = Object.keys(bundledRegistry.agents);
47
+ throw RegistryError.agentNotFound(agentId, available);
48
+ }
49
+ const targetDir = path.join(agentsDir, agentId);
50
+ try {
51
+ await fs.access(targetDir);
52
+ logger.info(`Agent '${agentId}' already installed`);
53
+ const mainFile = agentEntry.main || path.basename(agentEntry.source);
54
+ return path.join(targetDir, mainFile);
55
+ } catch {
56
+ }
57
+ await fs.mkdir(agentsDir, { recursive: true });
58
+ const sourcePath = resolveBundledScript(`agents/${agentEntry.source}`);
59
+ const tempDir = `${targetDir}.tmp.${Date.now()}`;
60
+ try {
61
+ if (agentEntry.source.endsWith("/")) {
62
+ await copyDirectory(sourcePath, tempDir);
63
+ } else {
64
+ await fs.mkdir(tempDir, { recursive: true });
65
+ const targetFile = path.join(tempDir, path.basename(sourcePath));
66
+ await fs.copyFile(sourcePath, targetFile);
67
+ }
68
+ await fs.rename(tempDir, targetDir);
69
+ logger.info(`\u2713 Installed agent '${agentId}' to ${targetDir}`);
70
+ if (options?.injectPreferences !== false) {
71
+ try {
72
+ const preferences = await loadGlobalPreferences();
73
+ await writePreferencesToAgent(targetDir, preferences);
74
+ logger.info(`\u2713 Applied global preferences to '${agentId}'`);
75
+ } catch (error) {
76
+ logger.warn(
77
+ `Failed to inject preferences: ${error instanceof Error ? error.message : String(error)}`
78
+ );
79
+ }
80
+ }
81
+ const userRegistryPath = getUserRegistryPath(agentsDir);
82
+ const userRegistry = await loadUserRegistry(userRegistryPath);
83
+ if (!userRegistry.agents.some((a) => a.id === agentId)) {
84
+ const mainFile = agentEntry.main || path.basename(agentEntry.source);
85
+ userRegistry.agents.push({
86
+ id: agentId,
87
+ name: agentEntry.name,
88
+ description: agentEntry.description,
89
+ configPath: `./${agentId}/${mainFile}`,
90
+ author: agentEntry.author,
91
+ tags: agentEntry.tags
92
+ });
93
+ await saveUserRegistry(userRegistryPath, userRegistry);
94
+ }
95
+ return path.join(targetDir, agentEntry.main || path.basename(agentEntry.source));
96
+ } catch (error) {
97
+ try {
98
+ await fs.rm(tempDir, { recursive: true, force: true });
99
+ } catch {
100
+ }
101
+ throw RegistryError.installationFailed(
102
+ agentId,
103
+ error instanceof Error ? error.message : String(error)
104
+ );
105
+ }
106
+ }
107
+ async function installCustomAgent(agentId, sourcePath, metadata, options) {
108
+ const agentsDir = getAgentsDir(options);
109
+ const targetDir = path.join(agentsDir, agentId);
110
+ logger.info(`Installing custom agent: ${agentId}`);
111
+ try {
112
+ const bundledRegistryPath = resolveBundledScript("agents/agent-registry.json");
113
+ const bundledContent = await fs.readFile(bundledRegistryPath, "utf-8");
114
+ const bundledRegistry = JSON.parse(bundledContent);
115
+ if (agentId in bundledRegistry.agents) {
116
+ throw RegistryError.customAgentNameConflict(agentId);
117
+ }
118
+ } catch (error) {
119
+ if (error instanceof Error && error.message.includes("conflicts with builtin")) {
120
+ throw error;
121
+ }
122
+ logger.debug(
123
+ `Could not validate against bundled registry: ${error instanceof Error ? error.message : String(error)}`
124
+ );
125
+ }
126
+ try {
127
+ await fs.access(targetDir);
128
+ throw RegistryError.agentAlreadyExists(agentId);
129
+ } catch (error) {
130
+ if (error.code !== "ENOENT") {
131
+ throw error;
132
+ }
133
+ }
134
+ const resolvedSource = path.resolve(sourcePath);
135
+ let stat;
136
+ try {
137
+ stat = await fs.stat(resolvedSource);
138
+ } catch (_error) {
139
+ throw ConfigError.fileNotFound(resolvedSource);
140
+ }
141
+ await fs.mkdir(agentsDir, { recursive: true });
142
+ try {
143
+ if (stat.isDirectory()) {
144
+ await copyDirectory(resolvedSource, targetDir);
145
+ } else {
146
+ await fs.mkdir(targetDir, { recursive: true });
147
+ const filename = path.basename(resolvedSource);
148
+ await fs.copyFile(resolvedSource, path.join(targetDir, filename));
149
+ }
150
+ logger.info(`\u2713 Installed custom agent '${agentId}' to ${targetDir}`);
151
+ const userRegistryPath = getUserRegistryPath(agentsDir);
152
+ const userRegistry = await loadUserRegistry(userRegistryPath);
153
+ const configFile = stat.isDirectory() ? "agent.yml" : path.basename(resolvedSource);
154
+ userRegistry.agents.push({
155
+ id: agentId,
156
+ name: metadata.name || agentId,
157
+ description: metadata.description,
158
+ configPath: `./${agentId}/${configFile}`,
159
+ author: metadata.author,
160
+ tags: metadata.tags || []
161
+ });
162
+ await saveUserRegistry(userRegistryPath, userRegistry);
163
+ return path.join(targetDir, configFile);
164
+ } catch (error) {
165
+ try {
166
+ await fs.rm(targetDir, { recursive: true, force: true });
167
+ } catch {
168
+ }
169
+ throw RegistryError.installationFailed(
170
+ agentId,
171
+ error instanceof Error ? error.message : String(error)
172
+ );
173
+ }
174
+ }
175
+ async function uninstallAgent(agentId, options) {
176
+ const agentsDir = getAgentsDir(options);
177
+ const targetDir = path.join(agentsDir, agentId);
178
+ logger.info(`Uninstalling agent: ${agentId}`);
179
+ try {
180
+ await fs.access(targetDir);
181
+ } catch (_error) {
182
+ throw RegistryError.agentNotInstalled(agentId);
183
+ }
184
+ await fs.rm(targetDir, { recursive: true, force: true });
185
+ logger.info(`\u2713 Removed agent directory: ${targetDir}`);
186
+ const userRegistryPath = getUserRegistryPath(agentsDir);
187
+ try {
188
+ const userRegistry = await loadUserRegistry(userRegistryPath);
189
+ userRegistry.agents = userRegistry.agents.filter((a) => a.id !== agentId);
190
+ await saveUserRegistry(userRegistryPath, userRegistry);
191
+ logger.info(`\u2713 Removed '${agentId}' from user registry`);
192
+ } catch (error) {
193
+ logger.warn(
194
+ `Failed to update user registry: ${error instanceof Error ? error.message : String(error)}`
195
+ );
196
+ }
197
+ }
198
+ async function listInstalledAgents(options) {
199
+ const agentsDir = getAgentsDir(options);
200
+ try {
201
+ const entries = await fs.readdir(agentsDir, { withFileTypes: true });
202
+ return entries.filter((e) => e.isDirectory()).map((e) => e.name);
203
+ } catch (error) {
204
+ if (error.code === "ENOENT") {
205
+ return [];
206
+ }
207
+ throw error;
208
+ }
209
+ }
210
+ export {
211
+ installBundledAgent,
212
+ installCustomAgent,
213
+ listInstalledAgents,
214
+ uninstallAgent
215
+ };
@@ -0,0 +1,116 @@
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 custom_models_exports = {};
30
+ __export(custom_models_exports, {
31
+ CustomModelSchema: () => CustomModelSchema,
32
+ deleteCustomModel: () => deleteCustomModel,
33
+ getCustomModel: () => getCustomModel,
34
+ getCustomModelsPath: () => getCustomModelsPath,
35
+ loadCustomModels: () => loadCustomModels,
36
+ saveCustomModel: () => saveCustomModel
37
+ });
38
+ module.exports = __toCommonJS(custom_models_exports);
39
+ var import_zod = require("zod");
40
+ var import_fs = require("fs");
41
+ var path = __toESM(require("path"), 1);
42
+ var import_path = require("../utils/path.js");
43
+ const CustomModelSchema = import_zod.z.object({
44
+ name: import_zod.z.string().min(1),
45
+ baseURL: import_zod.z.string().url(),
46
+ displayName: import_zod.z.string().optional(),
47
+ maxInputTokens: import_zod.z.number().int().positive().optional(),
48
+ maxOutputTokens: import_zod.z.number().int().positive().optional()
49
+ });
50
+ const StorageSchema = import_zod.z.object({
51
+ version: import_zod.z.literal(1),
52
+ models: import_zod.z.array(CustomModelSchema)
53
+ });
54
+ function getCustomModelsPath() {
55
+ return (0, import_path.getDextoGlobalPath)("models", "custom-models.json");
56
+ }
57
+ async function loadCustomModels() {
58
+ const filePath = getCustomModelsPath();
59
+ try {
60
+ const content = await import_fs.promises.readFile(filePath, "utf-8");
61
+ const parsed = StorageSchema.safeParse(JSON.parse(content));
62
+ if (!parsed.success) {
63
+ console.warn(
64
+ `[custom-models] Failed to parse ${filePath}: ${parsed.error.issues.map((i) => i.message).join(", ")}`
65
+ );
66
+ return [];
67
+ }
68
+ return parsed.data.models;
69
+ } catch (error) {
70
+ if (error.code === "ENOENT") {
71
+ return [];
72
+ }
73
+ throw error;
74
+ }
75
+ }
76
+ async function saveCustomModel(model) {
77
+ const parsed = CustomModelSchema.safeParse(model);
78
+ if (!parsed.success) {
79
+ throw new Error(`Invalid model: ${parsed.error.issues.map((i) => i.message).join(", ")}`);
80
+ }
81
+ const models = await loadCustomModels();
82
+ const existingIndex = models.findIndex((m) => m.name === parsed.data.name);
83
+ if (existingIndex >= 0) {
84
+ models[existingIndex] = parsed.data;
85
+ } else {
86
+ models.push(parsed.data);
87
+ }
88
+ await writeCustomModels(models);
89
+ }
90
+ async function deleteCustomModel(name) {
91
+ const models = await loadCustomModels();
92
+ const filtered = models.filter((m) => m.name !== name);
93
+ if (filtered.length === models.length) {
94
+ return false;
95
+ }
96
+ await writeCustomModels(filtered);
97
+ return true;
98
+ }
99
+ async function getCustomModel(name) {
100
+ const models = await loadCustomModels();
101
+ return models.find((m) => m.name === name) ?? null;
102
+ }
103
+ async function writeCustomModels(models) {
104
+ const filePath = getCustomModelsPath();
105
+ await import_fs.promises.mkdir(path.dirname(filePath), { recursive: true });
106
+ await import_fs.promises.writeFile(filePath, JSON.stringify({ version: 1, models }, null, 2), "utf-8");
107
+ }
108
+ // Annotate the CommonJS export names for ESM import in node:
109
+ 0 && (module.exports = {
110
+ CustomModelSchema,
111
+ deleteCustomModel,
112
+ getCustomModel,
113
+ getCustomModelsPath,
114
+ loadCustomModels,
115
+ saveCustomModel
116
+ });
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Custom Models Persistence
3
+ *
4
+ * Manages saved openai-compatible model configurations.
5
+ * Stored in ~/.dexto/models/custom-models.json
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Schema for a saved openai-compatible model configuration.
10
+ */
11
+ export declare const CustomModelSchema: z.ZodObject<{
12
+ name: z.ZodString;
13
+ baseURL: z.ZodString;
14
+ displayName: z.ZodOptional<z.ZodString>;
15
+ maxInputTokens: z.ZodOptional<z.ZodNumber>;
16
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ name: string;
19
+ baseURL: string;
20
+ displayName?: string | undefined;
21
+ maxInputTokens?: number | undefined;
22
+ maxOutputTokens?: number | undefined;
23
+ }, {
24
+ name: string;
25
+ baseURL: string;
26
+ displayName?: string | undefined;
27
+ maxInputTokens?: number | undefined;
28
+ maxOutputTokens?: number | undefined;
29
+ }>;
30
+ export type CustomModel = z.output<typeof CustomModelSchema>;
31
+ /**
32
+ * Get the path to the custom models storage file.
33
+ */
34
+ export declare function getCustomModelsPath(): string;
35
+ /**
36
+ * Load custom models from storage.
37
+ */
38
+ export declare function loadCustomModels(): Promise<CustomModel[]>;
39
+ /**
40
+ * Save a custom model to storage.
41
+ */
42
+ export declare function saveCustomModel(model: CustomModel): Promise<void>;
43
+ /**
44
+ * Delete a custom model by name.
45
+ */
46
+ export declare function deleteCustomModel(name: string): Promise<boolean>;
47
+ /**
48
+ * Get a specific custom model by name.
49
+ */
50
+ export declare function getCustomModel(name: string): Promise<CustomModel | null>;
51
+ //# sourceMappingURL=custom-models.d.ts.map
@@ -0,0 +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;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AAEH,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"}
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+ import { promises as fs } from "fs";
3
+ import * as path from "path";
4
+ import { getDextoGlobalPath } from "../utils/path.js";
5
+ const CustomModelSchema = z.object({
6
+ name: z.string().min(1),
7
+ baseURL: z.string().url(),
8
+ displayName: z.string().optional(),
9
+ maxInputTokens: z.number().int().positive().optional(),
10
+ maxOutputTokens: z.number().int().positive().optional()
11
+ });
12
+ const StorageSchema = z.object({
13
+ version: z.literal(1),
14
+ models: z.array(CustomModelSchema)
15
+ });
16
+ function getCustomModelsPath() {
17
+ return getDextoGlobalPath("models", "custom-models.json");
18
+ }
19
+ async function loadCustomModels() {
20
+ const filePath = getCustomModelsPath();
21
+ try {
22
+ const content = await fs.readFile(filePath, "utf-8");
23
+ const parsed = StorageSchema.safeParse(JSON.parse(content));
24
+ if (!parsed.success) {
25
+ console.warn(
26
+ `[custom-models] Failed to parse ${filePath}: ${parsed.error.issues.map((i) => i.message).join(", ")}`
27
+ );
28
+ return [];
29
+ }
30
+ return parsed.data.models;
31
+ } catch (error) {
32
+ if (error.code === "ENOENT") {
33
+ return [];
34
+ }
35
+ throw error;
36
+ }
37
+ }
38
+ async function saveCustomModel(model) {
39
+ const parsed = CustomModelSchema.safeParse(model);
40
+ if (!parsed.success) {
41
+ throw new Error(`Invalid model: ${parsed.error.issues.map((i) => i.message).join(", ")}`);
42
+ }
43
+ const models = await loadCustomModels();
44
+ const existingIndex = models.findIndex((m) => m.name === parsed.data.name);
45
+ if (existingIndex >= 0) {
46
+ models[existingIndex] = parsed.data;
47
+ } else {
48
+ models.push(parsed.data);
49
+ }
50
+ await writeCustomModels(models);
51
+ }
52
+ async function deleteCustomModel(name) {
53
+ const models = await loadCustomModels();
54
+ const filtered = models.filter((m) => m.name !== name);
55
+ if (filtered.length === models.length) {
56
+ return false;
57
+ }
58
+ await writeCustomModels(filtered);
59
+ return true;
60
+ }
61
+ async function getCustomModel(name) {
62
+ const models = await loadCustomModels();
63
+ return models.find((m) => m.name === name) ?? null;
64
+ }
65
+ async function writeCustomModels(models) {
66
+ const filePath = getCustomModelsPath();
67
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
68
+ await fs.writeFile(filePath, JSON.stringify({ version: 1, models }, null, 2), "utf-8");
69
+ }
70
+ export {
71
+ CustomModelSchema,
72
+ deleteCustomModel,
73
+ getCustomModel,
74
+ getCustomModelsPath,
75
+ loadCustomModels,
76
+ saveCustomModel
77
+ };
@@ -29,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var registry_exports = {};
30
30
  __export(registry_exports, {
31
31
  LocalAgentRegistry: () => LocalAgentRegistry,
32
- getAgentRegistry: () => getAgentRegistry
32
+ getAgentRegistry: () => getAgentRegistry,
33
+ loadBundledRegistryAgents: () => loadBundledRegistryAgents
33
34
  });
34
35
  module.exports = __toCommonJS(registry_exports);
35
36
  var import_fs = require("fs");
@@ -167,6 +168,10 @@ class LocalAgentRegistry {
167
168
  return configPath;
168
169
  }
169
170
  }
171
+ // TODO: Consider removing install/uninstall methods from LocalAgentRegistry class.
172
+ // Installing/uninstalling from registry to local agents/ is better suited as a CLI command.
173
+ // A bundler/opinionated project structure should help - agents/ will by default be their registry.
174
+ // For now these methods remain for backward compatibility.
170
175
  /**
171
176
  * Install agent atomically using temp + rename pattern
172
177
  * @param agentId ID of the agent to install
@@ -472,8 +477,22 @@ function getAgentRegistry() {
472
477
  }
473
478
  return cachedRegistry;
474
479
  }
480
+ function loadBundledRegistryAgents() {
481
+ try {
482
+ const registryPath = (0, import_path2.resolveBundledScript)("agents/agent-registry.json");
483
+ const content = (0, import_fs.readFileSync)(registryPath, "utf-8");
484
+ const registry = JSON.parse(content);
485
+ return registry.agents || {};
486
+ } catch (error) {
487
+ import_core.logger.warn(
488
+ `Could not load bundled registry: ${error instanceof Error ? error.message : String(error)}`
489
+ );
490
+ return {};
491
+ }
492
+ }
475
493
  // Annotate the CommonJS export names for ESM import in node:
476
494
  0 && (module.exports = {
477
495
  LocalAgentRegistry,
478
- getAgentRegistry
496
+ getAgentRegistry,
497
+ loadBundledRegistryAgents
479
498
  });
@@ -127,4 +127,9 @@ export declare class LocalAgentRegistry implements AgentRegistry {
127
127
  * Get cached registry instance (singleton pattern)
128
128
  */
129
129
  export declare function getAgentRegistry(): LocalAgentRegistry;
130
+ /**
131
+ * Load bundled agent registry (agents field only)
132
+ * Returns empty object on error - use for non-critical lookups like display names
133
+ */
134
+ export declare function loadBundledRegistryAgents(): Record<string, AgentRegistryEntry>;
130
135
  //# sourceMappingURL=registry.d.ts.map
@@ -1 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AC;KACjB,EACD,iBAAiB,GAAE,OAAc,GAClC,OAAO,CAAC,MAAM,CAAC;IAqKlB;;;;;;;OAOG;IACG,YAAY,CACd,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,OAAc,EAC3B,iBAAiB,GAAE,OAAc,GAClC,OAAO,CAAC,MAAM,CAAC;IAsClB;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAsB7C;;OAEG;YACW,sBAAsB;IAYpC;;;;;;OAMG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA8C/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAKrD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAY9E"}
@@ -141,6 +141,10 @@ class LocalAgentRegistry {
141
141
  return configPath;
142
142
  }
143
143
  }
144
+ // TODO: Consider removing install/uninstall methods from LocalAgentRegistry class.
145
+ // Installing/uninstalling from registry to local agents/ is better suited as a CLI command.
146
+ // A bundler/opinionated project structure should help - agents/ will by default be their registry.
147
+ // For now these methods remain for backward compatibility.
144
148
  /**
145
149
  * Install agent atomically using temp + rename pattern
146
150
  * @param agentId ID of the agent to install
@@ -446,7 +450,21 @@ function getAgentRegistry() {
446
450
  }
447
451
  return cachedRegistry;
448
452
  }
453
+ function loadBundledRegistryAgents() {
454
+ try {
455
+ const registryPath = resolveBundledScript("agents/agent-registry.json");
456
+ const content = readFileSync(registryPath, "utf-8");
457
+ const registry = JSON.parse(content);
458
+ return registry.agents || {};
459
+ } catch (error) {
460
+ logger.warn(
461
+ `Could not load bundled registry: ${error instanceof Error ? error.message : String(error)}`
462
+ );
463
+ return {};
464
+ }
465
+ }
449
466
  export {
450
467
  LocalAgentRegistry,
451
- getAgentRegistry
468
+ getAgentRegistry,
469
+ loadBundledRegistryAgents
452
470
  };
@@ -13,17 +13,17 @@ export declare const AgentRegistryEntrySchema: z.ZodObject<{
13
13
  main: z.ZodOptional<z.ZodString>;
14
14
  type: z.ZodDefault<z.ZodEnum<["builtin", "custom"]>>;
15
15
  }, "strict", z.ZodTypeAny, {
16
- name: string;
17
- type: "custom" | "builtin";
18
16
  id: string;
17
+ name: string;
19
18
  description: string;
20
19
  author: string;
21
20
  tags: string[];
21
+ type: "custom" | "builtin";
22
22
  source: string;
23
23
  main?: string | undefined;
24
24
  }, {
25
- name: string;
26
25
  id: string;
26
+ name: string;
27
27
  description: string;
28
28
  author: string;
29
29
  tags: string[];
@@ -47,17 +47,17 @@ export declare const RegistrySchema: z.ZodObject<{
47
47
  main: z.ZodOptional<z.ZodString>;
48
48
  type: z.ZodDefault<z.ZodEnum<["builtin", "custom"]>>;
49
49
  }, "strict", z.ZodTypeAny, {
50
- name: string;
51
- type: "custom" | "builtin";
52
50
  id: string;
51
+ name: string;
53
52
  description: string;
54
53
  author: string;
55
54
  tags: string[];
55
+ type: "custom" | "builtin";
56
56
  source: string;
57
57
  main?: string | undefined;
58
58
  }, {
59
- name: string;
60
59
  id: string;
60
+ name: string;
61
61
  description: string;
62
62
  author: string;
63
63
  tags: string[];
@@ -68,20 +68,20 @@ export declare const RegistrySchema: z.ZodObject<{
68
68
  }, "strict", z.ZodTypeAny, {
69
69
  version: string;
70
70
  agents: Record<string, {
71
- name: string;
72
- type: "custom" | "builtin";
73
71
  id: string;
72
+ name: string;
74
73
  description: string;
75
74
  author: string;
76
75
  tags: string[];
76
+ type: "custom" | "builtin";
77
77
  source: string;
78
78
  main?: string | undefined;
79
79
  }>;
80
80
  }, {
81
81
  version: string;
82
82
  agents: Record<string, {
83
- name: string;
84
83
  id: string;
84
+ name: string;
85
85
  description: string;
86
86
  author: string;
87
87
  tags: string[];