@defai.digital/agent-domain 13.0.3

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 (77) hide show
  1. package/LICENSE +214 -0
  2. package/dist/enhanced-executor.d.ts +170 -0
  3. package/dist/enhanced-executor.d.ts.map +1 -0
  4. package/dist/enhanced-executor.js +1072 -0
  5. package/dist/enhanced-executor.js.map +1 -0
  6. package/dist/executor.d.ts +120 -0
  7. package/dist/executor.d.ts.map +1 -0
  8. package/dist/executor.js +929 -0
  9. package/dist/executor.js.map +1 -0
  10. package/dist/index.d.ts +25 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +34 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/loader.d.ts +50 -0
  15. package/dist/loader.d.ts.map +1 -0
  16. package/dist/loader.js +160 -0
  17. package/dist/loader.js.map +1 -0
  18. package/dist/persistent-registry.d.ts +105 -0
  19. package/dist/persistent-registry.d.ts.map +1 -0
  20. package/dist/persistent-registry.js +183 -0
  21. package/dist/persistent-registry.js.map +1 -0
  22. package/dist/production-factories.d.ts +70 -0
  23. package/dist/production-factories.d.ts.map +1 -0
  24. package/dist/production-factories.js +434 -0
  25. package/dist/production-factories.js.map +1 -0
  26. package/dist/prompt-executor.d.ts +119 -0
  27. package/dist/prompt-executor.d.ts.map +1 -0
  28. package/dist/prompt-executor.js +211 -0
  29. package/dist/prompt-executor.js.map +1 -0
  30. package/dist/registry.d.ts +57 -0
  31. package/dist/registry.d.ts.map +1 -0
  32. package/dist/registry.js +123 -0
  33. package/dist/registry.js.map +1 -0
  34. package/dist/selection-service.d.ts +74 -0
  35. package/dist/selection-service.d.ts.map +1 -0
  36. package/dist/selection-service.js +322 -0
  37. package/dist/selection-service.js.map +1 -0
  38. package/dist/selector.d.ts +51 -0
  39. package/dist/selector.d.ts.map +1 -0
  40. package/dist/selector.js +249 -0
  41. package/dist/selector.js.map +1 -0
  42. package/dist/stub-checkpoint.d.ts +23 -0
  43. package/dist/stub-checkpoint.d.ts.map +1 -0
  44. package/dist/stub-checkpoint.js +137 -0
  45. package/dist/stub-checkpoint.js.map +1 -0
  46. package/dist/stub-delegation-tracker.d.ts +25 -0
  47. package/dist/stub-delegation-tracker.d.ts.map +1 -0
  48. package/dist/stub-delegation-tracker.js +118 -0
  49. package/dist/stub-delegation-tracker.js.map +1 -0
  50. package/dist/stub-parallel-executor.d.ts +19 -0
  51. package/dist/stub-parallel-executor.d.ts.map +1 -0
  52. package/dist/stub-parallel-executor.js +176 -0
  53. package/dist/stub-parallel-executor.js.map +1 -0
  54. package/dist/types.d.ts +614 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/dist/types.js +15 -0
  57. package/dist/types.js.map +1 -0
  58. package/dist/workflow-templates.d.ts +117 -0
  59. package/dist/workflow-templates.d.ts.map +1 -0
  60. package/dist/workflow-templates.js +342 -0
  61. package/dist/workflow-templates.js.map +1 -0
  62. package/package.json +51 -0
  63. package/src/enhanced-executor.ts +1395 -0
  64. package/src/executor.ts +1153 -0
  65. package/src/index.ts +172 -0
  66. package/src/loader.ts +191 -0
  67. package/src/persistent-registry.ts +235 -0
  68. package/src/production-factories.ts +613 -0
  69. package/src/prompt-executor.ts +310 -0
  70. package/src/registry.ts +167 -0
  71. package/src/selection-service.ts +411 -0
  72. package/src/selector.ts +299 -0
  73. package/src/stub-checkpoint.ts +187 -0
  74. package/src/stub-delegation-tracker.ts +161 -0
  75. package/src/stub-parallel-executor.ts +224 -0
  76. package/src/types.ts +784 -0
  77. package/src/workflow-templates.ts +393 -0
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Agent Workflow Templates
3
+ *
4
+ * Predefined workflow templates for common agent patterns.
5
+ * These templates can be used when registering agents to provide
6
+ * standard workflow steps without custom configuration.
7
+ *
8
+ * Usage:
9
+ * - Use 'prompt-response' for simple Q&A agents
10
+ * - Use 'research' for agents that need to gather information
11
+ * - Use 'code-review' for agents that analyze code
12
+ * - Use 'multi-step' for agents with sequential processing
13
+ */
14
+ import type { AgentWorkflowStep } from '@defai.digital/contracts';
15
+ /**
16
+ * Available workflow template names
17
+ */
18
+ export type WorkflowTemplateName = 'prompt-response' | 'research' | 'code-review' | 'multi-step' | 'delegate-chain' | 'agent-selection';
19
+ /**
20
+ * Workflow template definition
21
+ */
22
+ export interface WorkflowTemplate {
23
+ /** Template identifier */
24
+ name: WorkflowTemplateName;
25
+ /** Human-readable description */
26
+ description: string;
27
+ /** Workflow steps */
28
+ steps: AgentWorkflowStep[];
29
+ /** Required configuration keys */
30
+ requiredConfig?: string[];
31
+ /** Optional configuration with defaults */
32
+ defaultConfig?: Record<string, unknown>;
33
+ }
34
+ /**
35
+ * Prompt-Response Template
36
+ *
37
+ * Simple single-step workflow for Q&A style interactions.
38
+ * The agent uses its system prompt to respond to user input.
39
+ */
40
+ export declare const PROMPT_RESPONSE_TEMPLATE: WorkflowTemplate;
41
+ /**
42
+ * Research Template
43
+ *
44
+ * Multi-step workflow for research tasks:
45
+ * 1. Analyze the research question
46
+ * 2. Gather information (via tools if available)
47
+ * 3. Synthesize findings into a response
48
+ */
49
+ export declare const RESEARCH_TEMPLATE: WorkflowTemplate;
50
+ /**
51
+ * Code Review Template
52
+ *
53
+ * Workflow for reviewing code:
54
+ * 1. Understand the code structure
55
+ * 2. Analyze for issues and patterns
56
+ * 3. Generate review report
57
+ */
58
+ export declare const CODE_REVIEW_TEMPLATE: WorkflowTemplate;
59
+ /**
60
+ * Multi-Step Template
61
+ *
62
+ * Generic multi-step workflow for sequential processing:
63
+ * 1. Plan the approach
64
+ * 2. Execute the plan
65
+ * 3. Review and refine
66
+ */
67
+ export declare const MULTI_STEP_TEMPLATE: WorkflowTemplate;
68
+ /**
69
+ * Delegate Chain Template
70
+ *
71
+ * Workflow that demonstrates delegation to other agents.
72
+ * Useful for orchestration patterns.
73
+ */
74
+ export declare const DELEGATE_CHAIN_TEMPLATE: WorkflowTemplate;
75
+ /**
76
+ * Agent Selection Template
77
+ *
78
+ * Workflow for intelligent agent selection:
79
+ * 1. Analyze the task to understand requirements
80
+ * 2. Match task against agent capabilities
81
+ * 3. Select best agent with confidence scoring
82
+ *
83
+ * Invariants enforced:
84
+ * - INV-AGT-SEL-001: Deterministic selection
85
+ * - INV-AGT-SEL-002: Confidence range [0,1]
86
+ * - INV-AGT-SEL-003: Results sorted by confidence
87
+ * - INV-AGT-SEL-004: Fallback to standard agent
88
+ * - INV-AGT-SEL-005: exampleTasks boost scoring
89
+ * - INV-AGT-SEL-006: notForTasks reduce scoring
90
+ */
91
+ export declare const AGENT_SELECTION_TEMPLATE: WorkflowTemplate;
92
+ /**
93
+ * All available workflow templates
94
+ */
95
+ export declare const WORKFLOW_TEMPLATES: Record<WorkflowTemplateName, WorkflowTemplate>;
96
+ /**
97
+ * Gets a workflow template by name
98
+ */
99
+ export declare function getWorkflowTemplate(name: string): WorkflowTemplate | undefined;
100
+ /**
101
+ * Gets all available template names
102
+ */
103
+ export declare function getAvailableTemplates(): WorkflowTemplateName[];
104
+ /**
105
+ * Creates workflow steps from a template
106
+ * Optionally applies custom configuration to the template
107
+ */
108
+ export declare function createWorkflowFromTemplate(templateName: string, customConfig?: Record<string, unknown>): AgentWorkflowStep[] | undefined;
109
+ /**
110
+ * Validates that a template name is valid
111
+ */
112
+ export declare function isValidTemplateName(name: string): name is WorkflowTemplateName;
113
+ /**
114
+ * Gets template description for display
115
+ */
116
+ export declare function getTemplateDescription(name: string): string | undefined;
117
+ //# sourceMappingURL=workflow-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-templates.d.ts","sourceRoot":"","sources":["../src/workflow-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,UAAU,GACV,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,CAAC;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AED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvE"}
@@ -0,0 +1,342 @@
1
+ /**
2
+ * Agent Workflow Templates
3
+ *
4
+ * Predefined workflow templates for common agent patterns.
5
+ * These templates can be used when registering agents to provide
6
+ * standard workflow steps without custom configuration.
7
+ *
8
+ * Usage:
9
+ * - Use 'prompt-response' for simple Q&A agents
10
+ * - Use 'research' for agents that need to gather information
11
+ * - Use 'code-review' for agents that analyze code
12
+ * - Use 'multi-step' for agents with sequential processing
13
+ */
14
+ /**
15
+ * Prompt-Response Template
16
+ *
17
+ * Simple single-step workflow for Q&A style interactions.
18
+ * The agent uses its system prompt to respond to user input.
19
+ */
20
+ export const PROMPT_RESPONSE_TEMPLATE = {
21
+ name: 'prompt-response',
22
+ description: 'Simple single-step prompt-response workflow. Uses system prompt to generate response.',
23
+ steps: [
24
+ {
25
+ stepId: 'respond',
26
+ name: 'Generate Response',
27
+ description: 'Process input using system prompt and generate response',
28
+ type: 'prompt',
29
+ config: {
30
+ prompt: '{{input}}',
31
+ useSystemPrompt: true,
32
+ },
33
+ },
34
+ ],
35
+ };
36
+ /**
37
+ * Research Template
38
+ *
39
+ * Multi-step workflow for research tasks:
40
+ * 1. Analyze the research question
41
+ * 2. Gather information (via tools if available)
42
+ * 3. Synthesize findings into a response
43
+ */
44
+ export const RESEARCH_TEMPLATE = {
45
+ name: 'research',
46
+ description: 'Research workflow with analysis, gathering, and synthesis steps.',
47
+ steps: [
48
+ {
49
+ stepId: 'analyze',
50
+ name: 'Analyze Question',
51
+ description: 'Break down the research question and identify key aspects',
52
+ type: 'prompt',
53
+ config: {
54
+ prompt: 'Analyze this research question and identify the key aspects to investigate:\n\n{{input}}\n\nList the main points to research.',
55
+ useSystemPrompt: true,
56
+ },
57
+ },
58
+ {
59
+ stepId: 'gather',
60
+ name: 'Gather Information',
61
+ description: 'Collect relevant information based on analysis',
62
+ type: 'prompt',
63
+ dependencies: ['analyze'],
64
+ config: {
65
+ prompt: 'Based on the analysis:\n\n{{steps.analyze.output}}\n\nProvide detailed information on each aspect. Use your knowledge to answer comprehensively.',
66
+ useSystemPrompt: true,
67
+ },
68
+ },
69
+ {
70
+ stepId: 'synthesize',
71
+ name: 'Synthesize Response',
72
+ description: 'Combine gathered information into a coherent response',
73
+ type: 'prompt',
74
+ dependencies: ['gather'],
75
+ config: {
76
+ prompt: 'Synthesize the following information into a clear, comprehensive response to the original question:\n\nOriginal Question: {{input}}\n\nGathered Information:\n{{steps.gather.output}}\n\nProvide a well-structured response.',
77
+ useSystemPrompt: true,
78
+ },
79
+ },
80
+ ],
81
+ };
82
+ /**
83
+ * Code Review Template
84
+ *
85
+ * Workflow for reviewing code:
86
+ * 1. Understand the code structure
87
+ * 2. Analyze for issues and patterns
88
+ * 3. Generate review report
89
+ */
90
+ export const CODE_REVIEW_TEMPLATE = {
91
+ name: 'code-review',
92
+ description: 'Code review workflow with structure analysis, issue detection, and report generation.',
93
+ steps: [
94
+ {
95
+ stepId: 'understand',
96
+ name: 'Understand Code',
97
+ description: 'Analyze the structure and purpose of the code',
98
+ type: 'prompt',
99
+ config: {
100
+ prompt: 'Analyze this code and explain its structure, purpose, and main components:\n\n{{input}}',
101
+ useSystemPrompt: true,
102
+ },
103
+ },
104
+ {
105
+ stepId: 'analyze',
106
+ name: 'Analyze Issues',
107
+ description: 'Identify potential issues, bugs, and improvement opportunities',
108
+ type: 'prompt',
109
+ dependencies: ['understand'],
110
+ config: {
111
+ prompt: 'Based on the code understanding:\n\n{{steps.understand.output}}\n\nIdentify:\n1. Potential bugs or errors\n2. Performance issues\n3. Security concerns\n4. Code style and best practices\n5. Opportunities for improvement',
112
+ useSystemPrompt: true,
113
+ },
114
+ },
115
+ {
116
+ stepId: 'report',
117
+ name: 'Generate Report',
118
+ description: 'Create a structured code review report',
119
+ type: 'prompt',
120
+ dependencies: ['analyze'],
121
+ config: {
122
+ prompt: 'Create a structured code review report based on the analysis:\n\n{{steps.analyze.output}}\n\nFormat the report with:\n- Summary\n- Critical Issues (if any)\n- Warnings\n- Suggestions\n- Overall Assessment',
123
+ useSystemPrompt: true,
124
+ },
125
+ },
126
+ ],
127
+ };
128
+ /**
129
+ * Multi-Step Template
130
+ *
131
+ * Generic multi-step workflow for sequential processing:
132
+ * 1. Plan the approach
133
+ * 2. Execute the plan
134
+ * 3. Review and refine
135
+ */
136
+ export const MULTI_STEP_TEMPLATE = {
137
+ name: 'multi-step',
138
+ description: 'Generic multi-step workflow with planning, execution, and review phases.',
139
+ steps: [
140
+ {
141
+ stepId: 'plan',
142
+ name: 'Plan Approach',
143
+ description: 'Create a plan for addressing the task',
144
+ type: 'prompt',
145
+ config: {
146
+ prompt: 'Create a step-by-step plan to address this task:\n\n{{input}}\n\nList the concrete steps needed.',
147
+ useSystemPrompt: true,
148
+ },
149
+ },
150
+ {
151
+ stepId: 'execute',
152
+ name: 'Execute Plan',
153
+ description: 'Execute each step of the plan',
154
+ type: 'prompt',
155
+ dependencies: ['plan'],
156
+ config: {
157
+ prompt: 'Execute the following plan step by step:\n\n{{steps.plan.output}}\n\nProvide the output for each step.',
158
+ useSystemPrompt: true,
159
+ },
160
+ },
161
+ {
162
+ stepId: 'review',
163
+ name: 'Review Results',
164
+ description: 'Review and refine the execution results',
165
+ type: 'prompt',
166
+ dependencies: ['execute'],
167
+ config: {
168
+ prompt: 'Review the execution results:\n\n{{steps.execute.output}}\n\nProvide:\n1. Summary of what was accomplished\n2. Any refinements or corrections needed\n3. Final response to the original task: {{input}}',
169
+ useSystemPrompt: true,
170
+ },
171
+ },
172
+ ],
173
+ };
174
+ /**
175
+ * Delegate Chain Template
176
+ *
177
+ * Workflow that demonstrates delegation to other agents.
178
+ * Useful for orchestration patterns.
179
+ */
180
+ export const DELEGATE_CHAIN_TEMPLATE = {
181
+ name: 'delegate-chain',
182
+ description: 'Workflow that delegates to specialized agents for different aspects.',
183
+ steps: [
184
+ {
185
+ stepId: 'analyze-task',
186
+ name: 'Analyze Task',
187
+ description: 'Analyze the task and determine delegation strategy',
188
+ type: 'prompt',
189
+ config: {
190
+ prompt: 'Analyze this task and determine which aspects should be handled:\n\n{{input}}\n\nIdentify the key components and what expertise is needed.',
191
+ useSystemPrompt: true,
192
+ },
193
+ },
194
+ {
195
+ stepId: 'coordinate',
196
+ name: 'Coordinate Work',
197
+ description: 'Coordinate the work based on analysis',
198
+ type: 'prompt',
199
+ dependencies: ['analyze-task'],
200
+ config: {
201
+ prompt: 'Based on the task analysis:\n\n{{steps.analyze-task.output}}\n\nDetermine how to best address each component. Provide your response.',
202
+ useSystemPrompt: true,
203
+ },
204
+ },
205
+ {
206
+ stepId: 'finalize',
207
+ name: 'Finalize Response',
208
+ description: 'Combine all results into final response',
209
+ type: 'prompt',
210
+ dependencies: ['coordinate'],
211
+ config: {
212
+ prompt: 'Combine all the work into a final comprehensive response:\n\nOriginal Task: {{input}}\n\nCoordinated Work:\n{{steps.coordinate.output}}\n\nProvide the final response.',
213
+ useSystemPrompt: true,
214
+ },
215
+ },
216
+ ],
217
+ requiredConfig: [],
218
+ };
219
+ /**
220
+ * Agent Selection Template
221
+ *
222
+ * Workflow for intelligent agent selection:
223
+ * 1. Analyze the task to understand requirements
224
+ * 2. Match task against agent capabilities
225
+ * 3. Select best agent with confidence scoring
226
+ *
227
+ * Invariants enforced:
228
+ * - INV-AGT-SEL-001: Deterministic selection
229
+ * - INV-AGT-SEL-002: Confidence range [0,1]
230
+ * - INV-AGT-SEL-003: Results sorted by confidence
231
+ * - INV-AGT-SEL-004: Fallback to standard agent
232
+ * - INV-AGT-SEL-005: exampleTasks boost scoring
233
+ * - INV-AGT-SEL-006: notForTasks reduce scoring
234
+ */
235
+ export const AGENT_SELECTION_TEMPLATE = {
236
+ name: 'agent-selection',
237
+ description: 'Workflow for selecting the best agent based on task analysis and capability matching.',
238
+ steps: [
239
+ {
240
+ stepId: 'analyze-task',
241
+ name: 'Analyze Task Requirements',
242
+ description: 'Extract key requirements and intent from the task description',
243
+ type: 'prompt',
244
+ config: {
245
+ prompt: 'Analyze this task and extract:\n1. Primary intent (what needs to be done)\n2. Required capabilities\n3. Domain keywords\n4. Task category\n\nTask: {{input}}\n\nProvide a structured analysis.',
246
+ useSystemPrompt: true,
247
+ },
248
+ },
249
+ {
250
+ stepId: 'match-capabilities',
251
+ name: 'Match Against Capabilities',
252
+ description: 'Score available agents based on task requirements',
253
+ type: 'tool',
254
+ dependencies: ['analyze-task'],
255
+ config: {
256
+ tool: 'agent_recommend',
257
+ passTaskAnalysis: true,
258
+ },
259
+ },
260
+ {
261
+ stepId: 'validate-selection',
262
+ name: 'Validate Selection',
263
+ description: 'Verify the selected agent is appropriate and provide reasoning',
264
+ type: 'prompt',
265
+ dependencies: ['match-capabilities'],
266
+ config: {
267
+ prompt: 'Based on the task analysis:\n{{steps.analyze-task.output}}\n\nAnd the agent recommendation:\n{{steps.match-capabilities.output}}\n\nValidate this is the best choice and explain:\n1. Why this agent is suitable\n2. What capabilities match the task\n3. Any limitations to be aware of\n4. Confidence level in the selection',
268
+ useSystemPrompt: true,
269
+ },
270
+ },
271
+ ],
272
+ requiredConfig: [],
273
+ defaultConfig: {
274
+ minConfidence: 0.3,
275
+ maxAlternatives: 3,
276
+ },
277
+ };
278
+ /**
279
+ * All available workflow templates
280
+ */
281
+ export const WORKFLOW_TEMPLATES = {
282
+ 'prompt-response': PROMPT_RESPONSE_TEMPLATE,
283
+ 'research': RESEARCH_TEMPLATE,
284
+ 'code-review': CODE_REVIEW_TEMPLATE,
285
+ 'multi-step': MULTI_STEP_TEMPLATE,
286
+ 'delegate-chain': DELEGATE_CHAIN_TEMPLATE,
287
+ 'agent-selection': AGENT_SELECTION_TEMPLATE,
288
+ };
289
+ /**
290
+ * Gets a workflow template by name
291
+ */
292
+ export function getWorkflowTemplate(name) {
293
+ return WORKFLOW_TEMPLATES[name];
294
+ }
295
+ /**
296
+ * Gets all available template names
297
+ */
298
+ export function getAvailableTemplates() {
299
+ return Object.keys(WORKFLOW_TEMPLATES);
300
+ }
301
+ /**
302
+ * Creates workflow steps from a template
303
+ * Optionally applies custom configuration to the template
304
+ */
305
+ export function createWorkflowFromTemplate(templateName, customConfig) {
306
+ const template = getWorkflowTemplate(templateName);
307
+ if (template === undefined) {
308
+ return undefined;
309
+ }
310
+ // If no custom config, return template steps directly
311
+ if (customConfig === undefined || Object.keys(customConfig).length === 0) {
312
+ return template.steps.map(step => ({ ...step }));
313
+ }
314
+ // Apply custom configuration to steps
315
+ return template.steps.map(step => {
316
+ const newConfig = { ...step.config };
317
+ // Merge custom config into step config
318
+ for (const [key, value] of Object.entries(customConfig)) {
319
+ if (key in newConfig) {
320
+ newConfig[key] = value;
321
+ }
322
+ }
323
+ return {
324
+ ...step,
325
+ config: newConfig,
326
+ };
327
+ });
328
+ }
329
+ /**
330
+ * Validates that a template name is valid
331
+ */
332
+ export function isValidTemplateName(name) {
333
+ return name in WORKFLOW_TEMPLATES;
334
+ }
335
+ /**
336
+ * Gets template description for display
337
+ */
338
+ export function getTemplateDescription(name) {
339
+ const template = getWorkflowTemplate(name);
340
+ return template?.description;
341
+ }
342
+ //# sourceMappingURL=workflow-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-templates.js","sourceRoot":"","sources":["../src/workflow-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAmCH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAqB;IACxD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,uFAAuF;IACpG,KAAK,EAAE;QACL;YACE,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE,yDAAyD;YACtE,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE;gBACN,MAAM,EAAE,WAAW;gBACnB,eAAe,EAAE,IAAI;aACtB;SACF;KACF;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD,IA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C,EAAE;QAC/B,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAErC,uCAAuC;QACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACxD,IAAI,GAAG,IAAI,SAAS,EAAE,CAAC;gBACrB,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO;YACL,GAAG,IAAI;YACP,MAAM,EAAE,SAAS;SAClB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,IAAI,kBAAkB,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,QAAQ,EAAE,WAAW,CAAC;AAC/B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@defai.digital/agent-domain",
3
+ "version": "13.0.3",
4
+ "type": "module",
5
+ "description": "Agent profiles and orchestration for AutomatosX",
6
+ "license": "Apache-2.0",
7
+ "author": "DEFAI Private Limited",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/defai-digital/automatosx.git",
11
+ "directory": "packages/core/agent-domain"
12
+ },
13
+ "homepage": "https://github.com/defai-digital/automatosx#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/defai-digital/automatosx/issues"
16
+ },
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "src"
28
+ ],
29
+ "engines": {
30
+ "node": ">=20.0.0"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "dependencies": {
36
+ "yaml": "^2.8.1",
37
+ "@defai.digital/ability-domain": "13.0.3",
38
+ "@defai.digital/agent-execution": "13.0.3",
39
+ "@defai.digital/contracts": "13.0.3"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.7.2"
43
+ },
44
+ "peerDependencies": {
45
+ "zod": "^3.23.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc --build",
49
+ "clean": "rm -rf dist"
50
+ }
51
+ }