@fractary/faber 2.1.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fractary/faber - Agents Module
3
+ *
4
+ * Agent type templates and selection for FABER workflows.
5
+ */
6
+ export * from './types.js';
7
+ export { AgentTypeRegistry, getAgentTypeRegistry, } from './type-registry.js';
8
+ export { AgentTypeSelector, getAgentTypeSelector, } from './selector.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fractary/faber - Agents Module
3
+ *
4
+ * Agent type templates and selection for FABER workflows.
5
+ */
6
+ export * from './types.js';
7
+ export { AgentTypeRegistry, getAgentTypeRegistry, } from './type-registry.js';
8
+ export { AgentTypeSelector, getAgentTypeSelector, } from './selector.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @fractary/faber - Agent Type Selector
3
+ *
4
+ * Selects the appropriate agent type based on context and requirements.
5
+ */
6
+ import type { SelectionContext, SelectionResult, SelectorConfig } from './types.js';
7
+ import { AgentTypeRegistry } from './type-registry.js';
8
+ /**
9
+ * AgentTypeSelector - Selects agent types based on context
10
+ *
11
+ * Uses keyword matching, FABER phase affinity, and other signals
12
+ * to recommend the most appropriate agent type.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const selector = new AgentTypeSelector();
17
+ * await selector.loadConfig();
18
+ *
19
+ * const result = selector.select({
20
+ * purpose: 'design an API endpoint',
21
+ * faber_phase: 'architect'
22
+ * });
23
+ *
24
+ * console.log(result.recommended); // 'asset-architect'
25
+ * console.log(result.confidence); // 0.85
26
+ * ```
27
+ */
28
+ export declare class AgentTypeSelector {
29
+ private config;
30
+ private registry;
31
+ private templatesPath;
32
+ private loaded;
33
+ constructor(options?: {
34
+ templatesPath?: string;
35
+ registry?: AgentTypeRegistry;
36
+ });
37
+ /**
38
+ * Load the selector configuration
39
+ */
40
+ loadConfig(): Promise<void>;
41
+ /**
42
+ * Select the most appropriate agent type for the given context
43
+ */
44
+ select(context: SelectionContext): SelectionResult;
45
+ /**
46
+ * Score types based on keyword matching
47
+ */
48
+ private scoreByKeywords;
49
+ /**
50
+ * Score types based on FABER phase affinity
51
+ */
52
+ private scoreByPhase;
53
+ /**
54
+ * Score types based on scope preference
55
+ */
56
+ private scoreByScope;
57
+ /**
58
+ * Score types based on validation target
59
+ */
60
+ private scoreByValidation;
61
+ /**
62
+ * Calculate the maximum possible score for a given context
63
+ */
64
+ private getMaxPossibleScore;
65
+ /**
66
+ * Normalize confidence to a meaningful range
67
+ */
68
+ private normalizeConfidence;
69
+ /**
70
+ * Get the configuration
71
+ */
72
+ getConfig(): SelectorConfig | null;
73
+ /**
74
+ * Check if selector is loaded
75
+ */
76
+ isLoaded(): boolean;
77
+ }
78
+ /**
79
+ * Get the default agent type selector (singleton)
80
+ */
81
+ export declare function getAgentTypeSelector(options?: {
82
+ templatesPath?: string;
83
+ registry?: AgentTypeRegistry;
84
+ }): AgentTypeSelector;
85
+ //# sourceMappingURL=selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/agents/selector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAEV,gBAAgB,EAChB,eAAe,EACf,cAAc,EAIf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AAmB7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;KAAO;IAOlF;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBjC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe;IA+ElD;;OAEG;IACH,OAAO,CAAC,eAAe;IAsCvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmBpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,SAAS,IAAI,cAAc,GAAG,IAAI;IAIlC;;OAEG;IACH,QAAQ,IAAI,OAAO;CAGpB;AAOD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,GAAG,iBAAiB,CAKpB"}
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @fractary/faber - Agent Type Selector
3
+ *
4
+ * Selects the appropriate agent type based on context and requirements.
5
+ */
6
+ import { readFile } from 'fs/promises';
7
+ import { join, resolve, dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import yaml from 'js-yaml';
10
+ const parseYaml = (content) => yaml.load(content);
11
+ import { getAgentTypeRegistry } from './type-registry.js';
12
+ /**
13
+ * Get the package root directory
14
+ * Works both in development (src/) and production (dist/)
15
+ */
16
+ function getPackageRoot() {
17
+ // In ESM, __dirname is not available, so we derive it
18
+ const currentFile = fileURLToPath(import.meta.url);
19
+ const currentDir = dirname(currentFile);
20
+ // Navigate up from sdk/js/src/agents or sdk/js/dist/agents to repo root
21
+ return resolve(currentDir, '..', '..', '..', '..');
22
+ }
23
+ /**
24
+ * Default templates path relative to package root
25
+ */
26
+ const DEFAULT_TEMPLATES_PATH = 'templates/agents';
27
+ /**
28
+ * AgentTypeSelector - Selects agent types based on context
29
+ *
30
+ * Uses keyword matching, FABER phase affinity, and other signals
31
+ * to recommend the most appropriate agent type.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const selector = new AgentTypeSelector();
36
+ * await selector.loadConfig();
37
+ *
38
+ * const result = selector.select({
39
+ * purpose: 'design an API endpoint',
40
+ * faber_phase: 'architect'
41
+ * });
42
+ *
43
+ * console.log(result.recommended); // 'asset-architect'
44
+ * console.log(result.confidence); // 0.85
45
+ * ```
46
+ */
47
+ export class AgentTypeSelector {
48
+ config = null;
49
+ registry;
50
+ templatesPath;
51
+ loaded = false;
52
+ constructor(options = {}) {
53
+ this.templatesPath = options.templatesPath
54
+ ? resolve(options.templatesPath)
55
+ : resolve(getPackageRoot(), DEFAULT_TEMPLATES_PATH);
56
+ this.registry = options.registry || getAgentTypeRegistry();
57
+ }
58
+ /**
59
+ * Load the selector configuration
60
+ */
61
+ async loadConfig() {
62
+ if (this.loaded)
63
+ return;
64
+ // Load selector.yaml
65
+ const selectorPath = join(this.templatesPath, 'selector.yaml');
66
+ try {
67
+ const selectorContent = await readFile(selectorPath, 'utf-8');
68
+ this.config = parseYaml(selectorContent);
69
+ }
70
+ catch (error) {
71
+ throw new Error(`Failed to load selector configuration from ${selectorPath}: ${error instanceof Error ? error.message : String(error)}`);
72
+ }
73
+ // Ensure registry is loaded
74
+ await this.registry.loadCoreTypes();
75
+ this.loaded = true;
76
+ }
77
+ /**
78
+ * Select the most appropriate agent type for the given context
79
+ */
80
+ select(context) {
81
+ if (!this.config) {
82
+ throw new Error('Selector not loaded. Call loadConfig() first.');
83
+ }
84
+ const scores = new Map();
85
+ const reasons = new Map();
86
+ // Initialize all types with base score
87
+ for (const typeId of this.registry.getTypeIds()) {
88
+ scores.set(typeId, 0);
89
+ reasons.set(typeId, []);
90
+ }
91
+ // Score based on keywords from purpose
92
+ if (context.purpose) {
93
+ this.scoreByKeywords(context.purpose, scores, reasons);
94
+ }
95
+ // Score based on explicit keywords
96
+ if (context.keywords && context.keywords.length > 0) {
97
+ for (const keyword of context.keywords) {
98
+ this.scoreByKeywords(keyword, scores, reasons);
99
+ }
100
+ }
101
+ // Score based on FABER phase
102
+ if (context.faber_phase) {
103
+ this.scoreByPhase(context.faber_phase, scores, reasons);
104
+ }
105
+ // Score based on scope preference
106
+ if (context.scope) {
107
+ this.scoreByScope(context.scope, scores, reasons);
108
+ }
109
+ // Score based on validation target
110
+ if (context.validates) {
111
+ this.scoreByValidation(context.validates, scores, reasons);
112
+ }
113
+ // Sort by score
114
+ const sortedTypes = Array.from(scores.entries())
115
+ .sort((a, b) => b[1] - a[1])
116
+ .map(([typeId, score]) => ({
117
+ typeId,
118
+ score,
119
+ reasons: reasons.get(typeId) || [],
120
+ }));
121
+ // Guard against empty results
122
+ if (sortedTypes.length === 0) {
123
+ throw new Error('No agent types available. Ensure registry is loaded with loadCoreTypes() first.');
124
+ }
125
+ // Determine confidence level
126
+ const topScore = sortedTypes[0].score;
127
+ const maxPossibleScore = this.getMaxPossibleScore(context);
128
+ const normalizedConfidence = Math.min(topScore / maxPossibleScore, 1);
129
+ const confidence = this.normalizeConfidence(normalizedConfidence);
130
+ // Build result
131
+ const result = {
132
+ recommended: sortedTypes[0].typeId,
133
+ confidence,
134
+ reasoning: sortedTypes[0].reasons.join('; ') || 'Default selection',
135
+ alternatives: sortedTypes.slice(1, 4).map((t) => ({
136
+ type_id: t.typeId,
137
+ confidence: Math.min(t.score / maxPossibleScore, 1),
138
+ reasoning: t.reasons.join('; ') || 'Alternative option',
139
+ })),
140
+ };
141
+ return result;
142
+ }
143
+ /**
144
+ * Score types based on keyword matching
145
+ */
146
+ scoreByKeywords(text, scores, reasons) {
147
+ if (!this.config)
148
+ return;
149
+ const lowerText = text.toLowerCase();
150
+ for (const [typeId, matchConfig] of Object.entries(this.config.keyword_matching)) {
151
+ const typeReasons = reasons.get(typeId) || [];
152
+ // Check positive keywords
153
+ for (const keyword of matchConfig.keywords) {
154
+ if (lowerText.includes(keyword.toLowerCase())) {
155
+ const currentScore = scores.get(typeId) || 0;
156
+ scores.set(typeId, currentScore + 10);
157
+ typeReasons.push(`Matched keyword: "${keyword}"`);
158
+ }
159
+ }
160
+ // Check negative keywords
161
+ if (matchConfig.negative_keywords) {
162
+ for (const keyword of matchConfig.negative_keywords) {
163
+ if (lowerText.includes(keyword.toLowerCase())) {
164
+ const currentScore = scores.get(typeId) || 0;
165
+ scores.set(typeId, currentScore - 5);
166
+ typeReasons.push(`Negative keyword: "${keyword}"`);
167
+ }
168
+ }
169
+ }
170
+ reasons.set(typeId, typeReasons);
171
+ }
172
+ }
173
+ /**
174
+ * Score types based on FABER phase affinity
175
+ */
176
+ scoreByPhase(phase, scores, reasons) {
177
+ if (!this.config)
178
+ return;
179
+ const phaseTypes = this.config.phase_affinity[phase] || [];
180
+ for (const typeId of phaseTypes) {
181
+ const currentScore = scores.get(typeId) || 0;
182
+ scores.set(typeId, currentScore + 15);
183
+ const typeReasons = reasons.get(typeId) || [];
184
+ typeReasons.push(`Phase affinity: ${phase}`);
185
+ reasons.set(typeId, typeReasons);
186
+ }
187
+ }
188
+ /**
189
+ * Score types based on scope preference
190
+ */
191
+ scoreByScope(scope, scores, reasons) {
192
+ for (const type of this.registry.getAllTypes()) {
193
+ if (type.scope === scope) {
194
+ const currentScore = scores.get(type.id) || 0;
195
+ scores.set(type.id, currentScore + 8);
196
+ const typeReasons = reasons.get(type.id) || [];
197
+ typeReasons.push(`Scope match: ${scope}`);
198
+ reasons.set(type.id, typeReasons);
199
+ }
200
+ }
201
+ }
202
+ /**
203
+ * Score types based on validation target
204
+ */
205
+ scoreByValidation(validatesType, scores, reasons) {
206
+ for (const type of this.registry.getAllTypes()) {
207
+ if (type.validates_agent_type === validatesType) {
208
+ const currentScore = scores.get(type.id) || 0;
209
+ scores.set(type.id, currentScore + 25);
210
+ const typeReasons = reasons.get(type.id) || [];
211
+ typeReasons.push(`Validates: ${validatesType}`);
212
+ reasons.set(type.id, typeReasons);
213
+ }
214
+ }
215
+ }
216
+ /**
217
+ * Calculate the maximum possible score for a given context
218
+ */
219
+ getMaxPossibleScore(context) {
220
+ let max = 10; // Base score for having any keywords
221
+ if (context.purpose)
222
+ max += 20; // Multiple keyword matches possible
223
+ if (context.keywords)
224
+ max += context.keywords.length * 10;
225
+ if (context.faber_phase)
226
+ max += 15;
227
+ if (context.scope)
228
+ max += 8;
229
+ if (context.validates)
230
+ max += 25;
231
+ return max;
232
+ }
233
+ /**
234
+ * Normalize confidence to a meaningful range
235
+ */
236
+ normalizeConfidence(raw) {
237
+ if (!this.config)
238
+ return raw;
239
+ const thresholds = this.config.confidence;
240
+ if (raw >= thresholds.high)
241
+ return raw;
242
+ if (raw >= thresholds.medium)
243
+ return raw;
244
+ return raw;
245
+ }
246
+ /**
247
+ * Get the configuration
248
+ */
249
+ getConfig() {
250
+ return this.config;
251
+ }
252
+ /**
253
+ * Check if selector is loaded
254
+ */
255
+ isLoaded() {
256
+ return this.loaded;
257
+ }
258
+ }
259
+ /**
260
+ * Singleton instance of the selector
261
+ */
262
+ let defaultSelector = null;
263
+ /**
264
+ * Get the default agent type selector (singleton)
265
+ */
266
+ export function getAgentTypeSelector(options) {
267
+ if (!defaultSelector || options) {
268
+ defaultSelector = new AgentTypeSelector(options);
269
+ }
270
+ return defaultSelector;
271
+ }
272
+ //# sourceMappingURL=selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.js","sourceRoot":"","sources":["../../src/agents/selector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAW1D,OAAO,EAAqB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE7E;;;GAGG;AACH,SAAS,cAAc;IACrB,sDAAsD;IACtD,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACxC,wEAAwE;IACxE,OAAO,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,GAA0B,IAAI,CAAC;IACrC,QAAQ,CAAoB;IAC5B,aAAa,CAAS;IACtB,MAAM,GAAY,KAAK,CAAC;IAEhC,YAAY,UAAoE,EAAE;QAChF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa;YACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;YAChC,CAAC,CAAC,OAAO,CAAC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M;YAAE,OAAO,GAAG,CAAC;QAE7B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QAE1C,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI;YAAE,OAAO,GAAG,CAAC;QACvC,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM;YAAE,OAAO,GAAG,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED;;GAEG;AACH,IAAI,eAAe,GAA6B,IAAI,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAGpC;IACC,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE,CAAC;QAChC,eAAe,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @fractary/faber - Agent Type Registry
3
+ *
4
+ * Registry for loading and managing agent type templates.
5
+ */
6
+ import type { AgentType, AgentTypeId, AgentTypeManifest, AgentTypeRegistryOptions, AgentTypeTemplate, AgentTypeStandards, AgentScope, FaberPhaseName, LoadFromUrlOptions } from './types.js';
7
+ /**
8
+ * AgentTypeRegistry - Loads and manages agent type templates
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const registry = new AgentTypeRegistry();
13
+ * await registry.loadCoreTypes();
14
+ *
15
+ * const architect = registry.getType('asset-architect');
16
+ * const allTypes = registry.getAllTypes();
17
+ * const assetTypes = registry.getTypesByScope('asset');
18
+ * ```
19
+ */
20
+ export declare class AgentTypeRegistry {
21
+ private types;
22
+ private templates;
23
+ private standards;
24
+ private manifest;
25
+ private templatesPath;
26
+ private loaded;
27
+ constructor(options?: AgentTypeRegistryOptions);
28
+ /**
29
+ * Load core agent types from the templates directory
30
+ */
31
+ loadCoreTypes(): Promise<void>;
32
+ /**
33
+ * Load a single type from its directory
34
+ */
35
+ private loadType;
36
+ /**
37
+ * Get a specific agent type by ID
38
+ */
39
+ getType(id: AgentTypeId): AgentType | undefined;
40
+ /**
41
+ * Get all loaded agent types
42
+ */
43
+ getAllTypes(): AgentType[];
44
+ /**
45
+ * Get agent types filtered by scope
46
+ */
47
+ getTypesByScope(scope: AgentScope): AgentType[];
48
+ /**
49
+ * Get agent types filtered by FABER phase
50
+ */
51
+ getTypesByPhase(phase: FaberPhaseName): AgentType[];
52
+ /**
53
+ * Get the template content for an agent type
54
+ */
55
+ getTemplate(id: AgentTypeId): AgentTypeTemplate | undefined;
56
+ /**
57
+ * Get the standards content for an agent type
58
+ */
59
+ getStandards(id: AgentTypeId): AgentTypeStandards | undefined;
60
+ /**
61
+ * Get the manifest
62
+ */
63
+ getManifest(): AgentTypeManifest | null;
64
+ /**
65
+ * Check if a type exists
66
+ */
67
+ hasType(id: AgentTypeId): boolean;
68
+ /**
69
+ * Get all type IDs
70
+ */
71
+ getTypeIds(): AgentTypeId[];
72
+ /**
73
+ * Get the validator type for a given type (if it has one)
74
+ */
75
+ getValidatorFor(id: AgentTypeId): AgentType | undefined;
76
+ /**
77
+ * Get the type that a validator validates
78
+ */
79
+ getValidatesType(validatorId: AgentTypeId): AgentType | undefined;
80
+ /**
81
+ * Load a custom type from a URL
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * await registry.loadCustomTypeFromUrl('my-custom-type', {
86
+ * url: 'https://example.com/my-types/my-custom-type'
87
+ * });
88
+ * ```
89
+ */
90
+ loadCustomTypeFromUrl(id: string, options: LoadFromUrlOptions): Promise<void>;
91
+ /**
92
+ * Clear all loaded types
93
+ */
94
+ clear(): void;
95
+ }
96
+ /**
97
+ * Get the default agent type registry (singleton)
98
+ */
99
+ export declare function getAgentTypeRegistry(options?: AgentTypeRegistryOptions): AgentTypeRegistry;
100
+ //# sourceMappingURL=type-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-registry.d.ts","sourceRoot":"","sources":["../../src/agents/type-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,iBAAiB,EAEjB,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAmBpB;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAkB;gBAEpB,OAAO,GAAE,wBAA6B;IAOlD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBpC;;OAEG;YACW,QAAQ;IA0BtB;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS;IAI/C;;OAEG;IACH,WAAW,IAAI,SAAS,EAAE;IAI1B;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAAE;IAI/C;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,EAAE;IAMnD;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,iBAAiB,GAAG,SAAS;IAM3D;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,WAAW,GAAG,kBAAkB,GAAG,SAAS;IAM7D;;OAEG;IACH,WAAW,IAAI,iBAAiB,GAAG,IAAI;IAIvC;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO;IAIjC;;OAEG;IACH,UAAU,IAAI,WAAW,EAAE;IAI3B;;OAEG;IACH,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS;IAcvD;;OAEG;IACH,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS;IAMjE;;;;;;;;;OASG;IACG,qBAAqB,CACzB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAiChB;;OAEG;IACH,KAAK,IAAI,IAAI;CAOd;AAOD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,wBAAwB,GACjC,iBAAiB,CAKnB"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * @fractary/faber - Agent Type Registry
3
+ *
4
+ * Registry for loading and managing agent type templates.
5
+ */
6
+ import { readFile } from 'fs/promises';
7
+ import { join, resolve, dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import yaml from 'js-yaml';
10
+ const parseYaml = (content) => yaml.load(content);
11
+ /**
12
+ * Get the package root directory
13
+ * Works both in development (src/) and production (dist/)
14
+ */
15
+ function getPackageRoot() {
16
+ // In ESM, __dirname is not available, so we derive it
17
+ const currentFile = fileURLToPath(import.meta.url);
18
+ const currentDir = dirname(currentFile);
19
+ // Navigate up from sdk/js/src/agents or sdk/js/dist/agents to repo root
20
+ return resolve(currentDir, '..', '..', '..', '..');
21
+ }
22
+ /**
23
+ * Default templates path relative to package root
24
+ */
25
+ const DEFAULT_TEMPLATES_PATH = 'templates/agents';
26
+ /**
27
+ * AgentTypeRegistry - Loads and manages agent type templates
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const registry = new AgentTypeRegistry();
32
+ * await registry.loadCoreTypes();
33
+ *
34
+ * const architect = registry.getType('asset-architect');
35
+ * const allTypes = registry.getAllTypes();
36
+ * const assetTypes = registry.getTypesByScope('asset');
37
+ * ```
38
+ */
39
+ export class AgentTypeRegistry {
40
+ types = new Map();
41
+ templates = new Map();
42
+ standards = new Map();
43
+ manifest = null;
44
+ templatesPath;
45
+ loaded = false;
46
+ constructor(options = {}) {
47
+ this.templatesPath = options.templatesPath
48
+ ? resolve(options.templatesPath)
49
+ : resolve(getPackageRoot(), DEFAULT_TEMPLATES_PATH);
50
+ // Note: baseUrl from options is available for future remote loading features
51
+ }
52
+ /**
53
+ * Load core agent types from the templates directory
54
+ */
55
+ async loadCoreTypes() {
56
+ if (this.loaded)
57
+ return;
58
+ // Load manifest
59
+ const manifestPath = join(this.templatesPath, 'manifest.yaml');
60
+ try {
61
+ const manifestContent = await readFile(manifestPath, 'utf-8');
62
+ this.manifest = parseYaml(manifestContent);
63
+ }
64
+ catch (error) {
65
+ throw new Error(`Failed to load agent types manifest from ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`);
66
+ }
67
+ // Load each type
68
+ for (const entry of this.manifest.agent_types) {
69
+ await this.loadType(entry);
70
+ }
71
+ this.loaded = true;
72
+ }
73
+ /**
74
+ * Load a single type from its directory
75
+ */
76
+ async loadType(entry) {
77
+ const typePath = join(this.templatesPath, entry.id);
78
+ try {
79
+ // Load agent.yaml
80
+ const typeYamlPath = join(typePath, 'agent.yaml');
81
+ const typeContent = await readFile(typeYamlPath, 'utf-8');
82
+ const typeData = parseYaml(typeContent);
83
+ this.types.set(entry.id, typeData);
84
+ // Load template.md
85
+ const templatePath = join(typePath, 'template.md');
86
+ const templateContent = await readFile(templatePath, 'utf-8');
87
+ this.templates.set(entry.id, templateContent);
88
+ // Load standards.md
89
+ const standardsPath = join(typePath, 'standards.md');
90
+ const standardsContent = await readFile(standardsPath, 'utf-8');
91
+ this.standards.set(entry.id, standardsContent);
92
+ }
93
+ catch (error) {
94
+ throw new Error(`Failed to load agent type '${entry.id}' from ${typePath}: ${error instanceof Error ? error.message : String(error)}`);
95
+ }
96
+ }
97
+ /**
98
+ * Get a specific agent type by ID
99
+ */
100
+ getType(id) {
101
+ return this.types.get(id);
102
+ }
103
+ /**
104
+ * Get all loaded agent types
105
+ */
106
+ getAllTypes() {
107
+ return Array.from(this.types.values());
108
+ }
109
+ /**
110
+ * Get agent types filtered by scope
111
+ */
112
+ getTypesByScope(scope) {
113
+ return this.getAllTypes().filter((type) => type.scope === scope);
114
+ }
115
+ /**
116
+ * Get agent types filtered by FABER phase
117
+ */
118
+ getTypesByPhase(phase) {
119
+ return this.getAllTypes().filter((type) => type.faber.phase_affinity.includes(phase));
120
+ }
121
+ /**
122
+ * Get the template content for an agent type
123
+ */
124
+ getTemplate(id) {
125
+ const content = this.templates.get(id);
126
+ if (!content)
127
+ return undefined;
128
+ return { type_id: id, content };
129
+ }
130
+ /**
131
+ * Get the standards content for an agent type
132
+ */
133
+ getStandards(id) {
134
+ const content = this.standards.get(id);
135
+ if (!content)
136
+ return undefined;
137
+ return { type_id: id, content };
138
+ }
139
+ /**
140
+ * Get the manifest
141
+ */
142
+ getManifest() {
143
+ return this.manifest;
144
+ }
145
+ /**
146
+ * Check if a type exists
147
+ */
148
+ hasType(id) {
149
+ return this.types.has(id);
150
+ }
151
+ /**
152
+ * Get all type IDs
153
+ */
154
+ getTypeIds() {
155
+ return Array.from(this.types.keys());
156
+ }
157
+ /**
158
+ * Get the validator type for a given type (if it has one)
159
+ */
160
+ getValidatorFor(id) {
161
+ const type = this.types.get(id);
162
+ if (!type)
163
+ return undefined;
164
+ // Find a validator that validates this type
165
+ for (const t of this.types.values()) {
166
+ if (t.validates_agent_type === id) {
167
+ return t;
168
+ }
169
+ }
170
+ return undefined;
171
+ }
172
+ /**
173
+ * Get the type that a validator validates
174
+ */
175
+ getValidatesType(validatorId) {
176
+ const validator = this.types.get(validatorId);
177
+ if (!validator?.validates_agent_type)
178
+ return undefined;
179
+ return this.types.get(validator.validates_agent_type);
180
+ }
181
+ /**
182
+ * Load a custom type from a URL
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * await registry.loadCustomTypeFromUrl('my-custom-type', {
187
+ * url: 'https://example.com/my-types/my-custom-type'
188
+ * });
189
+ * ```
190
+ */
191
+ async loadCustomTypeFromUrl(id, options) {
192
+ const { url } = options;
193
+ // Fetch agent.yaml
194
+ const typeUrl = `${url}/agent.yaml`;
195
+ const typeResponse = await fetch(typeUrl);
196
+ if (!typeResponse.ok) {
197
+ throw new Error(`Failed to fetch agent.yaml from ${typeUrl}`);
198
+ }
199
+ const typeContent = await typeResponse.text();
200
+ const typeData = parseYaml(typeContent);
201
+ // Override the ID to the provided one
202
+ typeData.id = id;
203
+ this.types.set(id, typeData);
204
+ // Fetch template.md
205
+ const templateUrl = `${url}/template.md`;
206
+ const templateResponse = await fetch(templateUrl);
207
+ if (templateResponse.ok) {
208
+ const templateContent = await templateResponse.text();
209
+ this.templates.set(id, templateContent);
210
+ }
211
+ // Fetch standards.md
212
+ const standardsUrl = `${url}/standards.md`;
213
+ const standardsResponse = await fetch(standardsUrl);
214
+ if (standardsResponse.ok) {
215
+ const standardsContent = await standardsResponse.text();
216
+ this.standards.set(id, standardsContent);
217
+ }
218
+ }
219
+ /**
220
+ * Clear all loaded types
221
+ */
222
+ clear() {
223
+ this.types.clear();
224
+ this.templates.clear();
225
+ this.standards.clear();
226
+ this.manifest = null;
227
+ this.loaded = false;
228
+ }
229
+ }
230
+ /**
231
+ * Singleton instance of the registry
232
+ */
233
+ let defaultRegistry = null;
234
+ /**
235
+ * Get the default agent type registry (singleton)
236
+ */
237
+ export function getAgentTypeRegistry(options) {
238
+ if (!defaultRegistry || options) {
239
+ defaultRegistry = new AgentTypeRegistry(options);
240
+ }
241
+ return defaultRegistry;
242
+ }
243
+ //# sourceMappingURL=type-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-registry.js","sourceRoot":"","sources":["../../src/agents/type-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,SA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iB,EAAE,gBAAgB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAED;;GAEG;AACH,IAAI,eAAe,GAA6B,IAAI,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAkC;IAElC,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE,CAAC;QAChC,eAAe,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @fractary/faber - Agent Types Module
3
+ *
4
+ * TypeScript interfaces for agent type templates and selection.
5
+ */
6
+ /** Agent scope - what level the agent operates at */
7
+ export type AgentScope = 'asset' | 'project';
8
+ /** Scope definition in manifest */
9
+ export interface AgentScopeDefinition {
10
+ id: AgentScope;
11
+ display_name: string;
12
+ description: string;
13
+ }
14
+ /** Agent type ID (e.g., 'asset-architect', 'project-auditor') */
15
+ export type AgentTypeId = 'asset-architect' | 'asset-engineer' | 'asset-configurator' | 'asset-debugger' | 'asset-architect-validator' | 'asset-engineer-validator' | 'asset-inspector' | 'project-auditor';
16
+ /** FABER phase names */
17
+ export type FaberPhaseName = 'frame' | 'architect' | 'build' | 'evaluate' | 'release' | 'any';
18
+ /** Model names */
19
+ export type ModelName = 'claude-haiku-4-5' | 'claude-sonnet-4-5' | 'claude-opus-4-5';
20
+ /** Tool names */
21
+ export type ToolName = 'Bash' | 'Read' | 'Write' | 'Edit' | 'Glob' | 'Grep' | 'AskUserQuestion' | 'Skill' | 'WebFetch' | 'WebSearch';
22
+ /** Agent type entry in manifest */
23
+ export interface AgentTypeManifestEntry {
24
+ id: AgentTypeId;
25
+ display_name: string;
26
+ scope: AgentScope;
27
+ path: string;
28
+ faber_phase: FaberPhaseName;
29
+ pairs_with?: AgentTypeId;
30
+ description: string;
31
+ }
32
+ /** Full manifest structure */
33
+ export interface AgentTypeManifest {
34
+ version: string;
35
+ base_url: string;
36
+ scopes: AgentScopeDefinition[];
37
+ agent_types: AgentTypeManifestEntry[];
38
+ }
39
+ /** Configuration for an agent type */
40
+ export interface AgentTypeConfig {
41
+ recommended_model: ModelName;
42
+ common_tools: ToolName[];
43
+ required_tools: ToolName[];
44
+ typical_complexity: 'low' | 'medium' | 'high';
45
+ requires_user_interaction: boolean;
46
+ maintains_state: boolean;
47
+ }
48
+ /** FABER integration configuration */
49
+ export interface AgentTypeFaberConfig {
50
+ phase_affinity: FaberPhaseName[];
51
+ exit_codes: AgentTypeExitCode[];
52
+ }
53
+ /** Exit code definition */
54
+ export interface AgentTypeExitCode {
55
+ code: number;
56
+ meaning: string;
57
+ }
58
+ /** Documentation for an agent type */
59
+ export interface AgentTypeDocumentation {
60
+ when_to_use: string[];
61
+ examples: string[];
62
+ }
63
+ /** Structure requirements for an agent type */
64
+ export interface AgentTypeStructure {
65
+ required_sections: string[];
66
+ recommended_sections: string[];
67
+ }
68
+ /** Critical rule definition */
69
+ export interface AgentTypeCriticalRule {
70
+ id: string;
71
+ title: string;
72
+ description: string;
73
+ }
74
+ /** Frontmatter schema property */
75
+ export interface FrontmatterProperty {
76
+ type: string;
77
+ pattern?: string;
78
+ description?: string;
79
+ enum?: string[];
80
+ default?: string;
81
+ maxLength?: number;
82
+ items?: FrontmatterProperty;
83
+ must_include?: string[];
84
+ note?: string;
85
+ }
86
+ /** Frontmatter schema */
87
+ export interface AgentTypeFrontmatterSchema {
88
+ required: string[];
89
+ optional: string[];
90
+ properties: Record<string, FrontmatterProperty>;
91
+ }
92
+ /** Validation rules */
93
+ export interface AgentTypeValidation {
94
+ implementation_steps_min?: number;
95
+ implementation_step_patterns?: string[];
96
+ ambiguous_terms_to_flag?: string[];
97
+ }
98
+ /** Output format specification */
99
+ export interface AgentTypeOutputFormat {
100
+ type: string;
101
+ required_sections?: string[];
102
+ recommended_sections?: string[];
103
+ deliverables?: string[];
104
+ required_fields?: string[];
105
+ recommended_fields?: string[];
106
+ modes?: Array<{
107
+ name: string;
108
+ description: string;
109
+ default?: boolean;
110
+ flag?: string;
111
+ }>;
112
+ }
113
+ /** Scoring configuration (for validators) */
114
+ export interface AgentTypeScoring {
115
+ pass_threshold: number;
116
+ weights: Record<string, number>;
117
+ }
118
+ /** Threshold configuration (for validators) */
119
+ export interface AgentTypeThresholds {
120
+ lint_errors?: number;
121
+ type_errors?: number;
122
+ test_pass_rate?: number;
123
+ coverage_minimum?: number;
124
+ }
125
+ /** Complete agent type definition (from agent.yaml) */
126
+ export interface AgentType {
127
+ id: AgentTypeId;
128
+ display_name: string;
129
+ scope: AgentScope;
130
+ description: string;
131
+ validates_agent_type?: AgentTypeId;
132
+ pairs_with?: AgentTypeId;
133
+ validation_mode?: 'static' | 'static+dynamic';
134
+ config: AgentTypeConfig;
135
+ faber: AgentTypeFaberConfig;
136
+ documentation: AgentTypeDocumentation;
137
+ structure: AgentTypeStructure;
138
+ critical_rules: AgentTypeCriticalRule[];
139
+ implementation_steps: string[];
140
+ output_format: AgentTypeOutputFormat;
141
+ frontmatter_schema: AgentTypeFrontmatterSchema;
142
+ validation?: AgentTypeValidation;
143
+ scoring?: AgentTypeScoring;
144
+ thresholds?: AgentTypeThresholds;
145
+ }
146
+ /** Template file content */
147
+ export interface AgentTypeTemplate {
148
+ type_id: AgentTypeId;
149
+ content: string;
150
+ }
151
+ /** Standards file content */
152
+ export interface AgentTypeStandards {
153
+ type_id: AgentTypeId;
154
+ content: string;
155
+ }
156
+ /** Context for selecting an agent type */
157
+ export interface SelectionContext {
158
+ /** Description of what the agent should do */
159
+ purpose?: string;
160
+ /** Keywords describing the agent */
161
+ keywords?: string[];
162
+ /** FABER phase the agent will be used in */
163
+ faber_phase?: FaberPhaseName;
164
+ /** Preferred scope */
165
+ scope?: AgentScope;
166
+ /** Whether the agent should validate another agent's output */
167
+ validates?: AgentTypeId;
168
+ }
169
+ /** Result of agent type selection */
170
+ export interface SelectionResult {
171
+ /** Recommended agent type */
172
+ recommended: AgentTypeId;
173
+ /** Confidence level (0-1) */
174
+ confidence: number;
175
+ /** Reasoning for the selection */
176
+ reasoning: string;
177
+ /** Alternative options with their confidence scores */
178
+ alternatives: Array<{
179
+ type_id: AgentTypeId;
180
+ confidence: number;
181
+ reasoning: string;
182
+ }>;
183
+ }
184
+ /** Keyword matching configuration for a type */
185
+ export interface KeywordMatchConfig {
186
+ keywords: string[];
187
+ negative_keywords?: string[];
188
+ }
189
+ /** Phase affinity mapping */
190
+ export type PhaseAffinityMap = Record<FaberPhaseName, AgentTypeId[]>;
191
+ /** Decision tree node */
192
+ export interface DecisionTreeNode {
193
+ question: string;
194
+ options: Array<{
195
+ label: string;
196
+ next?: string;
197
+ result?: AgentTypeId;
198
+ }>;
199
+ }
200
+ /** Decision tree */
201
+ export type DecisionTree = Record<string, DecisionTreeNode>;
202
+ /** Confidence thresholds */
203
+ export interface ConfidenceThresholds {
204
+ high: number;
205
+ medium: number;
206
+ low: number;
207
+ }
208
+ /** Agent type pairings (architect -> architect-validator) */
209
+ export type AgentTypePairings = Partial<Record<AgentTypeId, AgentTypeId>>;
210
+ /** Selector configuration (from selector.yaml) */
211
+ export interface SelectorConfig {
212
+ version: string;
213
+ description: string;
214
+ keyword_matching: Record<AgentTypeId, KeywordMatchConfig>;
215
+ phase_affinity: PhaseAffinityMap;
216
+ decision_tree: DecisionTree;
217
+ confidence: ConfidenceThresholds;
218
+ pairings: AgentTypePairings;
219
+ }
220
+ /** Options for creating an AgentTypeRegistry */
221
+ export interface AgentTypeRegistryOptions {
222
+ /** Path to templates directory (default: templates/agents) */
223
+ templatesPath?: string;
224
+ /** Base URL for remote loading */
225
+ baseUrl?: string;
226
+ }
227
+ /** Options for loading a type from URL */
228
+ export interface LoadFromUrlOptions {
229
+ /** Custom URL to load from */
230
+ url: string;
231
+ }
232
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7C,mCAAmC;AACnC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,UAAU,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,iEAAiE;AACjE,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,2BAA2B,GAC3B,0BAA0B,GAC1B,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,wBAAwB;AACxB,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,CAAC;AAE9F,kBAAkB;AAClB,MAAM,MAAM,SAAS,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAErF,iBAAiB;AACjB,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN,iBAAiB,GACjB,OAAO,GACP,UAAU,GACV,WAAW,CAAC;AAEhB,mCAAmC;AACnC,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,WAAW,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,cAAc,CAAC;IAC5B,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,WAAW,E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AAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAE1E,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAC1D,cAAc,EAAE,gBAAgB,CAAC;IACjC,aAAa,EAAE,YAAY,CAAC;IAC5B,UAAU,EAAE,oBAAoB,CAAC;IACjC,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAMD,gDAAgD;AAChD,MAAM,WAAW,wBAAwB;IACvC,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fractary/faber - Agent Types Module
3
+ *
4
+ * TypeScript interfaces for agent type templates and selection.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  * - state: Workflow state persistence
12
12
  * - workflow: FABER workflow orchestration
13
13
  * - storage: Artifact storage (local and Codex integration)
14
+ * - agents: Agent type templates and selection
14
15
  */
15
16
  export * from './types.js';
16
17
  export * from './errors.js';
@@ -22,4 +23,5 @@ export * from './logs/index.js';
22
23
  export * from './state/index.js';
23
24
  export * from './workflow/index.js';
24
25
  export * from './storage/index.js';
26
+ export * from './agents/index.js';
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@
11
11
  * - state: Workflow state persistence
12
12
  * - workflow: FABER workflow orchestration
13
13
  * - storage: Artifact storage (local and Codex integration)
14
+ * - agents: Agent type templates and selection
14
15
  */
15
16
  // Core exports
16
17
  export * from './types.js';
@@ -24,4 +25,5 @@ export * from './logs/index.js';
24
25
  export * from './state/index.js';
25
26
  export * from './workflow/index.js';
26
27
  export * from './storage/index.js';
28
+ export * from './agents/index.js';
27
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAe;AACf,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAe;AACf,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,iBAAiB;AACjB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractary/faber",
3
- "version": "2.1.3",
3
+ "version": "2.2.1",
4
4
  "description": "FABER SDK - Development toolkit for AI-assisted workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,6 +37,10 @@
37
37
  "./storage": {
38
38
  "types": "./dist/storage/index.d.ts",
39
39
  "default": "./dist/storage/index.js"
40
+ },
41
+ "./agents": {
42
+ "types": "./dist/agents/index.d.ts",
43
+ "default": "./dist/agents/index.js"
40
44
  }
41
45
  },
42
46
  "files": [