family-ai-agent 1.0.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 (132) hide show
  1. package/.env.example +49 -0
  2. package/README.md +161 -0
  3. package/dist/cli/index.d.ts +3 -0
  4. package/dist/cli/index.d.ts.map +1 -0
  5. package/dist/cli/index.js +336 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/config/index.d.ts +37 -0
  8. package/dist/config/index.d.ts.map +1 -0
  9. package/dist/config/index.js +68 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/config/models.d.ts +17 -0
  12. package/dist/config/models.d.ts.map +1 -0
  13. package/dist/config/models.js +128 -0
  14. package/dist/config/models.js.map +1 -0
  15. package/dist/core/agents/agent-factory.d.ts +31 -0
  16. package/dist/core/agents/agent-factory.d.ts.map +1 -0
  17. package/dist/core/agents/agent-factory.js +151 -0
  18. package/dist/core/agents/agent-factory.js.map +1 -0
  19. package/dist/core/agents/base-agent.d.ts +51 -0
  20. package/dist/core/agents/base-agent.d.ts.map +1 -0
  21. package/dist/core/agents/base-agent.js +245 -0
  22. package/dist/core/agents/base-agent.js.map +1 -0
  23. package/dist/core/agents/index.d.ts +8 -0
  24. package/dist/core/agents/index.d.ts.map +1 -0
  25. package/dist/core/agents/index.js +9 -0
  26. package/dist/core/agents/index.js.map +1 -0
  27. package/dist/core/agents/personalities/automation.d.ts +14 -0
  28. package/dist/core/agents/personalities/automation.d.ts.map +1 -0
  29. package/dist/core/agents/personalities/automation.js +146 -0
  30. package/dist/core/agents/personalities/automation.js.map +1 -0
  31. package/dist/core/agents/personalities/chat.d.ts +10 -0
  32. package/dist/core/agents/personalities/chat.d.ts.map +1 -0
  33. package/dist/core/agents/personalities/chat.js +132 -0
  34. package/dist/core/agents/personalities/chat.js.map +1 -0
  35. package/dist/core/agents/personalities/coding.d.ts +16 -0
  36. package/dist/core/agents/personalities/coding.d.ts.map +1 -0
  37. package/dist/core/agents/personalities/coding.js +166 -0
  38. package/dist/core/agents/personalities/coding.js.map +1 -0
  39. package/dist/core/agents/personalities/research.d.ts +13 -0
  40. package/dist/core/agents/personalities/research.d.ts.map +1 -0
  41. package/dist/core/agents/personalities/research.js +133 -0
  42. package/dist/core/agents/personalities/research.js.map +1 -0
  43. package/dist/core/agents/types.d.ts +102 -0
  44. package/dist/core/agents/types.d.ts.map +1 -0
  45. package/dist/core/agents/types.js +2 -0
  46. package/dist/core/agents/types.js.map +1 -0
  47. package/dist/core/orchestrator/graph.d.ts +118 -0
  48. package/dist/core/orchestrator/graph.d.ts.map +1 -0
  49. package/dist/core/orchestrator/graph.js +233 -0
  50. package/dist/core/orchestrator/graph.js.map +1 -0
  51. package/dist/database/client.d.ts +19 -0
  52. package/dist/database/client.d.ts.map +1 -0
  53. package/dist/database/client.js +95 -0
  54. package/dist/database/client.js.map +1 -0
  55. package/dist/index.d.ts +41 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +67 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/llm/openrouter-client.d.ts +45 -0
  60. package/dist/llm/openrouter-client.d.ts.map +1 -0
  61. package/dist/llm/openrouter-client.js +155 -0
  62. package/dist/llm/openrouter-client.js.map +1 -0
  63. package/dist/memory/conversation/index.d.ts +37 -0
  64. package/dist/memory/conversation/index.d.ts.map +1 -0
  65. package/dist/memory/conversation/index.js +196 -0
  66. package/dist/memory/conversation/index.js.map +1 -0
  67. package/dist/memory/index.d.ts +4 -0
  68. package/dist/memory/index.d.ts.map +1 -0
  69. package/dist/memory/index.js +5 -0
  70. package/dist/memory/index.js.map +1 -0
  71. package/dist/memory/knowledge-base/index.d.ts +51 -0
  72. package/dist/memory/knowledge-base/index.d.ts.map +1 -0
  73. package/dist/memory/knowledge-base/index.js +222 -0
  74. package/dist/memory/knowledge-base/index.js.map +1 -0
  75. package/dist/memory/longterm/vector-store.d.ts +44 -0
  76. package/dist/memory/longterm/vector-store.d.ts.map +1 -0
  77. package/dist/memory/longterm/vector-store.js +229 -0
  78. package/dist/memory/longterm/vector-store.js.map +1 -0
  79. package/dist/safety/audit-logger.d.ts +68 -0
  80. package/dist/safety/audit-logger.d.ts.map +1 -0
  81. package/dist/safety/audit-logger.js +215 -0
  82. package/dist/safety/audit-logger.js.map +1 -0
  83. package/dist/safety/guardrails/input-guardrail.d.ts +21 -0
  84. package/dist/safety/guardrails/input-guardrail.d.ts.map +1 -0
  85. package/dist/safety/guardrails/input-guardrail.js +145 -0
  86. package/dist/safety/guardrails/input-guardrail.js.map +1 -0
  87. package/dist/safety/guardrails/output-guardrail.d.ts +18 -0
  88. package/dist/safety/guardrails/output-guardrail.d.ts.map +1 -0
  89. package/dist/safety/guardrails/output-guardrail.js +125 -0
  90. package/dist/safety/guardrails/output-guardrail.js.map +1 -0
  91. package/dist/safety/index.d.ts +4 -0
  92. package/dist/safety/index.d.ts.map +1 -0
  93. package/dist/safety/index.js +5 -0
  94. package/dist/safety/index.js.map +1 -0
  95. package/dist/utils/errors.d.ts +36 -0
  96. package/dist/utils/errors.d.ts.map +1 -0
  97. package/dist/utils/errors.js +94 -0
  98. package/dist/utils/errors.js.map +1 -0
  99. package/dist/utils/logger.d.ts +8 -0
  100. package/dist/utils/logger.d.ts.map +1 -0
  101. package/dist/utils/logger.js +47 -0
  102. package/dist/utils/logger.js.map +1 -0
  103. package/docker/init-db.sql +149 -0
  104. package/docker/sandbox/Dockerfile.sandbox +29 -0
  105. package/docker-compose.yml +61 -0
  106. package/package.json +80 -0
  107. package/src/cli/index.ts +392 -0
  108. package/src/config/index.ts +85 -0
  109. package/src/config/models.ts +156 -0
  110. package/src/core/agents/agent-factory.ts +192 -0
  111. package/src/core/agents/base-agent.ts +333 -0
  112. package/src/core/agents/index.ts +27 -0
  113. package/src/core/agents/personalities/automation.ts +202 -0
  114. package/src/core/agents/personalities/chat.ts +159 -0
  115. package/src/core/agents/personalities/coding.ts +227 -0
  116. package/src/core/agents/personalities/research.ts +177 -0
  117. package/src/core/agents/types.ts +124 -0
  118. package/src/core/orchestrator/graph.ts +305 -0
  119. package/src/database/client.ts +109 -0
  120. package/src/index.ts +104 -0
  121. package/src/llm/openrouter-client.ts +218 -0
  122. package/src/memory/conversation/index.ts +313 -0
  123. package/src/memory/index.ts +23 -0
  124. package/src/memory/knowledge-base/index.ts +357 -0
  125. package/src/memory/longterm/vector-store.ts +364 -0
  126. package/src/safety/audit-logger.ts +357 -0
  127. package/src/safety/guardrails/input-guardrail.ts +191 -0
  128. package/src/safety/guardrails/output-guardrail.ts +160 -0
  129. package/src/safety/index.ts +21 -0
  130. package/src/utils/errors.ts +120 -0
  131. package/src/utils/logger.ts +74 -0
  132. package/tsconfig.json +37 -0
@@ -0,0 +1,166 @@
1
+ import { nanoid } from 'nanoid';
2
+ import { BaseAgent } from '../base-agent.js';
3
+ import { getRecommendedModel } from '../../../config/models.js';
4
+ const CODING_SYSTEM_PROMPT = `You are an expert Coding Agent in the Family AI Agent system, specializing in software development.
5
+
6
+ Your identity: "Adik" (Younger Sibling) - The brilliant coder
7
+ Your personality:
8
+ - Highly skilled and confident
9
+ - Detail-oriented and precise
10
+ - Creative problem solver
11
+ - Efficient and pragmatic
12
+
13
+ Your capabilities:
14
+ - Writing clean, efficient code in multiple languages
15
+ - Debugging and fixing errors
16
+ - Code review and optimization
17
+ - Explaining code and concepts
18
+ - Refactoring and improving code quality
19
+ - Writing tests and documentation
20
+ - Architecture and design decisions
21
+
22
+ Supported languages (proficient):
23
+ - JavaScript/TypeScript
24
+ - Python
25
+ - Go, Rust
26
+ - Java, C#
27
+ - SQL
28
+ - HTML/CSS
29
+ - Shell scripting
30
+
31
+ Coding principles:
32
+ 1. Write clean, readable, maintainable code
33
+ 2. Follow language-specific best practices
34
+ 3. Include error handling
35
+ 4. Consider edge cases
36
+ 5. Optimize for performance when needed
37
+ 6. Write self-documenting code
38
+ 7. Add comments only when necessary
39
+
40
+ When writing code:
41
+ - Start with understanding the requirements
42
+ - Plan the solution before coding
43
+ - Write modular, reusable code
44
+ - Test the logic mentally
45
+ - Provide clear explanations
46
+
47
+ When debugging:
48
+ - Analyze the error message carefully
49
+ - Identify the root cause
50
+ - Explain what went wrong
51
+ - Provide a fix with explanation
52
+
53
+ Code output format:
54
+ \`\`\`language
55
+ // code here
56
+ \`\`\`
57
+
58
+ Always explain your code decisions briefly.`;
59
+ export class CodingAgent extends BaseAgent {
60
+ constructor(tools = []) {
61
+ super({
62
+ identity: {
63
+ id: `coding-${nanoid(8)}`,
64
+ name: 'Adik',
65
+ role: 'coding',
66
+ description: 'Expert software development agent',
67
+ capabilities: [
68
+ 'code_generation',
69
+ 'debugging',
70
+ 'code_review',
71
+ 'refactoring',
72
+ 'testing',
73
+ 'documentation',
74
+ 'architecture',
75
+ 'optimization',
76
+ ],
77
+ },
78
+ model: getRecommendedModel('coding'),
79
+ temperature: 0.2, // Low temperature for precise code
80
+ systemPrompt: CODING_SYSTEM_PROMPT,
81
+ tools,
82
+ maxIterations: 10,
83
+ timeout: 180000, // 3 minutes for complex coding tasks
84
+ });
85
+ }
86
+ buildSystemPrompt(context, memories) {
87
+ let prompt = this.systemPrompt;
88
+ // Add code-related memories (previous solutions, patterns)
89
+ const codeMemories = memories.filter((m) => m.type === 'procedural' || m.metadata?.category === 'code');
90
+ if (codeMemories.length > 0) {
91
+ prompt += '\n\n## Relevant Code Patterns/Solutions\n';
92
+ for (const memory of codeMemories) {
93
+ prompt += `- ${memory.content}\n`;
94
+ }
95
+ }
96
+ // Add project context
97
+ if (context.projectLanguage) {
98
+ prompt += `\n\n## Project Language: ${context.projectLanguage}`;
99
+ }
100
+ if (context.codebase) {
101
+ prompt += '\n\n## Codebase Context\n';
102
+ prompt += JSON.stringify(context.codebase, null, 2);
103
+ }
104
+ if (context.existingCode) {
105
+ prompt += `\n\n## Existing Code\n\`\`\`\n${context.existingCode}\n\`\`\``;
106
+ }
107
+ if (context.errorMessage) {
108
+ prompt += `\n\n## Error to Debug\n${context.errorMessage}`;
109
+ }
110
+ return prompt;
111
+ }
112
+ async shouldHandoff(state, result) {
113
+ const output = String(result.output).toLowerCase();
114
+ // Check if research is needed
115
+ if (output.includes('need to research') ||
116
+ output.includes('requires investigation') ||
117
+ output.includes('look up documentation')) {
118
+ return {
119
+ shouldHandoff: true,
120
+ targetAgent: 'research',
121
+ reason: 'Need to research before implementation',
122
+ };
123
+ }
124
+ // Check if automation is needed
125
+ if (output.includes('deploy this') ||
126
+ output.includes('run regularly') ||
127
+ output.includes('automate deployment')) {
128
+ return {
129
+ shouldHandoff: true,
130
+ targetAgent: 'automation',
131
+ reason: 'Code ready for automation/deployment',
132
+ context: {
133
+ code: result.output,
134
+ },
135
+ };
136
+ }
137
+ return {
138
+ shouldHandoff: false,
139
+ reason: 'Coding task complete',
140
+ };
141
+ }
142
+ // Additional coding-specific methods
143
+ async generateCode(description, language = 'typescript') {
144
+ return this.execute(`Generate ${language} code for the following:\n\n${description}`, { task: 'code_generation', language });
145
+ }
146
+ async debug(code, error) {
147
+ return this.execute(`Debug the following code:\n\n\`\`\`\n${code}\n\`\`\`\n\nError:\n${error}`, { task: 'debugging' });
148
+ }
149
+ async review(code) {
150
+ return this.execute(`Review the following code for quality, bugs, and improvements:\n\n\`\`\`\n${code}\n\`\`\``, { task: 'code_review' });
151
+ }
152
+ async refactor(code, goal) {
153
+ return this.execute(`Refactor the following code with this goal: ${goal}\n\n\`\`\`\n${code}\n\`\`\``, { task: 'refactoring' });
154
+ }
155
+ async explainCode(code) {
156
+ return this.execute(`Explain the following code in detail:\n\n\`\`\`\n${code}\n\`\`\``, { task: 'explanation' });
157
+ }
158
+ async writeTests(code, framework = 'vitest') {
159
+ return this.execute(`Write ${framework} tests for the following code:\n\n\`\`\`\n${code}\n\`\`\``, { task: 'testing', framework });
160
+ }
161
+ }
162
+ export function createCodingAgent(tools = []) {
163
+ return new CodingAgent(tools);
164
+ }
165
+ export default CodingAgent;
166
+ //# sourceMappingURL=coding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding.js","source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IAAY,EAAE,YAAoB,QAAQ;QACzD,OAAO,IAAI,CAAC,OAAO,CACjB,SAAS,SAAS,6CAA6C,IAAI,UAAU,EAC7E,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAC/B,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,QAA8B,EAAE;IAChE,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { BaseAgent } from '../base-agent.js';
2
+ import type { AgentConfig, AgentState, TaskResult, RetrievedMemory, HandoffDecision } from '../types.js';
3
+ export declare class ResearchAgent extends BaseAgent {
4
+ constructor(tools?: AgentConfig['tools']);
5
+ protected buildSystemPrompt(context: Record<string, unknown>, memories: RetrievedMemory[]): string;
6
+ protected shouldHandoff(state: AgentState, result: TaskResult): Promise<HandoffDecision>;
7
+ summarize(content: string, maxLength?: number): Promise<TaskResult>;
8
+ factCheck(claim: string): Promise<TaskResult>;
9
+ compare(items: string[]): Promise<TaskResult>;
10
+ }
11
+ export declare function createResearchAgent(tools?: AgentConfig['tools']): ResearchAgent;
12
+ export default ResearchAgent;
13
+ //# sourceMappingURL=research.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/personalities/research.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAwCrB,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,KAAK,GAAE,WAAW,CAAC,OAAO,CAAM;IA0B5C,SAAS,CAAC,iBAAiB,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,EAAE,eAAe,EAAE,GAC1B,MAAM;cA4BO,aAAa,CAC3B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,eAAe,CAAC;IAyCrB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,OAAO,CAAC,UAAU,CAAC;IAOxE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAO7C,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;CAMpD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,WAAW,CAAC,OAAO,CAAM,GAAG,aAAa,CAEnF;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { nanoid } from 'nanoid';
2
+ import { BaseAgent } from '../base-agent.js';
3
+ import { getRecommendedModel } from '../../../config/models.js';
4
+ const RESEARCH_SYSTEM_PROMPT = `You are an expert Research Agent in the Family AI Agent system, specializing in information gathering and analysis.
5
+
6
+ Your identity: Research Specialist
7
+ Your personality:
8
+ - Thorough and methodical
9
+ - Fact-focused and objective
10
+ - Clear in presenting findings
11
+ - Good at synthesizing information from multiple sources
12
+
13
+ Your capabilities:
14
+ - Web search and information retrieval
15
+ - Fact-checking and verification
16
+ - Summarizing complex topics
17
+ - Comparing and analyzing data
18
+ - Creating research reports
19
+
20
+ Research methodology:
21
+ 1. Understand the research question clearly
22
+ 2. Identify key search terms and concepts
23
+ 3. Gather information from multiple sources
24
+ 4. Verify facts and cross-reference
25
+ 5. Synthesize findings into coherent summaries
26
+ 6. Cite sources when possible
27
+
28
+ Guidelines:
29
+ - Always prioritize accuracy over speed
30
+ - Clearly distinguish between facts and opinions
31
+ - Note any uncertainties or conflicting information
32
+ - Provide sources for claims when available
33
+ - Ask for clarification if the research question is ambiguous
34
+
35
+ When presenting findings:
36
+ - Start with a brief summary/answer
37
+ - Provide supporting details and evidence
38
+ - List sources and references
39
+ - Note any limitations or areas needing further research`;
40
+ export class ResearchAgent extends BaseAgent {
41
+ constructor(tools = []) {
42
+ super({
43
+ identity: {
44
+ id: `research-${nanoid(8)}`,
45
+ name: 'Researcher',
46
+ role: 'research',
47
+ description: 'Expert research and information gathering agent',
48
+ capabilities: [
49
+ 'web_search',
50
+ 'fact_checking',
51
+ 'summarization',
52
+ 'analysis',
53
+ 'report_writing',
54
+ 'data_comparison',
55
+ 'source_verification',
56
+ ],
57
+ },
58
+ model: getRecommendedModel('research'),
59
+ temperature: 0.3, // Lower temperature for factual accuracy
60
+ systemPrompt: RESEARCH_SYSTEM_PROMPT,
61
+ tools,
62
+ maxIterations: 15, // More iterations for thorough research
63
+ timeout: 180000, // 3 minutes for research tasks
64
+ });
65
+ }
66
+ buildSystemPrompt(context, memories) {
67
+ let prompt = this.systemPrompt;
68
+ // Add previous research findings from memory
69
+ const researchMemories = memories.filter((m) => m.type === 'episodic' || m.type === 'semantic');
70
+ if (researchMemories.length > 0) {
71
+ prompt += '\n\n## Previous Research Findings\n';
72
+ for (const memory of researchMemories) {
73
+ prompt += `- ${memory.content} (relevance: ${(memory.relevanceScore * 100).toFixed(0)}%)\n`;
74
+ }
75
+ }
76
+ // Add research context
77
+ if (context.researchTopic) {
78
+ prompt += `\n\n## Current Research Topic\n${context.researchTopic}`;
79
+ }
80
+ if (context.researchConstraints) {
81
+ prompt += `\n\n## Research Constraints\n`;
82
+ prompt += JSON.stringify(context.researchConstraints, null, 2);
83
+ }
84
+ return prompt;
85
+ }
86
+ async shouldHandoff(state, result) {
87
+ const output = String(result.output).toLowerCase();
88
+ // Check if implementation is needed
89
+ if (output.includes('to implement this') ||
90
+ output.includes('code needed') ||
91
+ output.includes('write the code')) {
92
+ return {
93
+ shouldHandoff: true,
94
+ targetAgent: 'coding',
95
+ reason: 'Research complete, implementation needed',
96
+ context: {
97
+ researchFindings: result.output,
98
+ },
99
+ };
100
+ }
101
+ // Check if automation is suggested
102
+ if (output.includes('automate this process') ||
103
+ output.includes('schedule regular')) {
104
+ return {
105
+ shouldHandoff: true,
106
+ targetAgent: 'automation',
107
+ reason: 'Research suggests automation solution',
108
+ context: {
109
+ researchFindings: result.output,
110
+ },
111
+ };
112
+ }
113
+ return {
114
+ shouldHandoff: false,
115
+ reason: 'Research task complete',
116
+ };
117
+ }
118
+ // Additional research-specific methods
119
+ async summarize(content, maxLength = 500) {
120
+ return this.execute(`Summarize the following content in ${maxLength} words or less:\n\n${content}`, { task: 'summarization' });
121
+ }
122
+ async factCheck(claim) {
123
+ return this.execute(`Fact-check the following claim and provide evidence:\n\n"${claim}"`, { task: 'fact_checking' });
124
+ }
125
+ async compare(items) {
126
+ return this.execute(`Compare and analyze the following items:\n\n${items.map((i, idx) => `${idx + 1}. ${i}`).join('\n')}`, { task: 'comparison' });
127
+ }
128
+ }
129
+ export function createResearchAgent(tools = []) {
130
+ return new ResearchAgent(tools);
131
+ }
132
+ export default ResearchAgent;
133
+ //# sourceMappingURL=research.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research.js","sourceRoot":"","sources":["../../../../src/core/agents/personalities/research.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAmC0B,CAAC;AAE1D,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAY,QAA8B,EAAE;QAC1C,KAAK,CAAC;YACJ,QAAQ,EAAE;gBACR,EAAE,EAAE,YAAY,MAAM,CAAC,CAAC,CAAC,EAAE;gBAC3B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,iDAAiD;gBAC9D,YAAY,EAAE;oBACZ,YAAY;oBACZ,eAAe;oBACf,eAAe;oBACf,UAAU;oBACV,gBAA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C,OAAO,CACjB,+CAA+C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACrG,EAAE,IAAI,EAAE,YAAY,EAAE,CACvB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,QAA8B,EAAE;IAClE,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,102 @@
1
+ import type { BaseMessage } from '@langchain/core/messages';
2
+ import type { StructuredTool } from '@langchain/core/tools';
3
+ export type AgentRole = 'supervisor' | 'research' | 'coding' | 'automation' | 'chat';
4
+ export type AgentStatus = 'idle' | 'thinking' | 'executing' | 'waiting' | 'completed' | 'error';
5
+ export interface AgentIdentity {
6
+ id: string;
7
+ name: string;
8
+ role: AgentRole;
9
+ description: string;
10
+ capabilities: string[];
11
+ }
12
+ export interface AgentConfig {
13
+ identity: AgentIdentity;
14
+ model: string;
15
+ temperature?: number;
16
+ maxTokens?: number;
17
+ systemPrompt: string;
18
+ tools: StructuredTool[];
19
+ maxIterations?: number;
20
+ timeout?: number;
21
+ }
22
+ export interface AgentState {
23
+ messages: BaseMessage[];
24
+ currentTask?: TaskDefinition;
25
+ activeAgents: AgentIdentity[];
26
+ sharedContext: Record<string, unknown>;
27
+ taskResults: TaskResult[];
28
+ nextAgent: string | null;
29
+ memories: RetrievedMemory[];
30
+ iterationCount: number;
31
+ status: AgentStatus;
32
+ }
33
+ export interface TaskDefinition {
34
+ id: string;
35
+ type: 'research' | 'coding' | 'automation' | 'chat' | 'complex';
36
+ description: string;
37
+ input: string;
38
+ priority: 'low' | 'normal' | 'high' | 'critical';
39
+ requiredCapabilities: string[];
40
+ context?: Record<string, unknown>;
41
+ parentTaskId?: string;
42
+ subtasks?: TaskDefinition[];
43
+ deadline?: Date;
44
+ }
45
+ export interface TaskResult {
46
+ taskId: string;
47
+ agentId: string;
48
+ status: 'success' | 'partial' | 'failed';
49
+ output: unknown;
50
+ error?: string;
51
+ executionTimeMs: number;
52
+ metadata?: Record<string, unknown>;
53
+ }
54
+ export interface RetrievedMemory {
55
+ id: string;
56
+ type: 'semantic' | 'episodic' | 'procedural';
57
+ content: string;
58
+ relevanceScore: number;
59
+ metadata?: Record<string, unknown>;
60
+ }
61
+ export interface AgentMessage {
62
+ id: string;
63
+ timestamp: Date;
64
+ sender: AgentIdentity;
65
+ recipient: AgentIdentity | 'supervisor' | 'broadcast';
66
+ type: 'request' | 'response' | 'handoff' | 'status' | 'error';
67
+ payload: {
68
+ task?: TaskDefinition;
69
+ result?: TaskResult;
70
+ context?: Record<string, unknown>;
71
+ reason?: string;
72
+ };
73
+ metadata: {
74
+ priority: 'low' | 'normal' | 'high' | 'critical';
75
+ threadId: string;
76
+ parentMessageId?: string;
77
+ };
78
+ }
79
+ export interface HandoffDecision {
80
+ shouldHandoff: boolean;
81
+ targetAgent?: AgentRole;
82
+ reason: string;
83
+ context?: Record<string, unknown>;
84
+ }
85
+ export interface RoutingDecision {
86
+ selectedAgents: AgentRole[];
87
+ executionMode: 'single' | 'sequential' | 'parallel';
88
+ reasoning: string;
89
+ }
90
+ export interface ToolResult {
91
+ success: boolean;
92
+ output: unknown;
93
+ error?: string;
94
+ }
95
+ export type AgentEventType = 'started' | 'thinking' | 'tool_call' | 'tool_result' | 'handoff' | 'completed' | 'error';
96
+ export interface AgentEvent {
97
+ type: AgentEventType;
98
+ agentId: string;
99
+ timestamp: Date;
100
+ data: Record<string, unknown>;
101
+ }
102
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/agents/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,E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U,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,QAAQ,EAAE;QACR,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;QACjD,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,SAAS,EAAE,CAAC;IAC5B,aAAa,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,UAAU,GACV,WAAW,GACX,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,CAAC;AAEZ,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/agents/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,118 @@
1
+ import { BaseMessage } from '@langchain/core/messages';
2
+ import type { AgentRole, TaskDefinition, TaskResult, RetrievedMemory, AgentIdentity } from '../agents/types.js';
3
+ export declare const AgentStateAnnotation: import("@langchain/langgraph").AnnotationRoot<{
4
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
5
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
6
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
7
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
8
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
9
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
10
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
11
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
12
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
13
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
14
+ }>;
15
+ export type GraphState = typeof AgentStateAnnotation.State;
16
+ export declare function createOrchestratorGraph(): import("@langchain/langgraph").CompiledStateGraph<import("@langchain/langgraph").StateType<{
17
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
18
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
19
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
20
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
21
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
22
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
23
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
24
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
25
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
26
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
27
+ }>, import("@langchain/langgraph").UpdateType<{
28
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
29
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
30
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
31
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
32
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
33
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
34
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
35
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
36
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
37
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
38
+ }>, "chat" | "supervisor" | "research" | "coding" | "automation" | "__start__", {
39
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
40
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
41
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
42
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
43
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
44
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
45
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
46
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
47
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
48
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
49
+ }, {
50
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
51
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
52
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
53
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
54
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
55
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
56
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
57
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
58
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
59
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
60
+ }, import("@langchain/langgraph").StateDefinition>;
61
+ export declare function getOrchestratorGraph(): import("@langchain/langgraph").CompiledStateGraph<import("@langchain/langgraph").StateType<{
62
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
63
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
64
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
65
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
66
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
67
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
68
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
69
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
70
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
71
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
72
+ }>, import("@langchain/langgraph").UpdateType<{
73
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
74
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
75
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
76
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
77
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
78
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
79
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
80
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
81
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
82
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
83
+ }>, "chat" | "supervisor" | "research" | "coding" | "automation" | "__start__", {
84
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
85
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
86
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
87
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
88
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
89
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
90
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
91
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
92
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
93
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
94
+ }, {
95
+ messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
96
+ input: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
97
+ currentTask: import("@langchain/langgraph").BinaryOperatorAggregate<TaskDefinition | null, TaskDefinition | null>;
98
+ activeAgents: import("@langchain/langgraph").BinaryOperatorAggregate<AgentIdentity[], AgentIdentity[]>;
99
+ sharedContext: import("@langchain/langgraph").BinaryOperatorAggregate<Record<string, unknown>, Record<string, unknown>>;
100
+ taskResults: import("@langchain/langgraph").BinaryOperatorAggregate<TaskResult[], TaskResult[]>;
101
+ memories: import("@langchain/langgraph").BinaryOperatorAggregate<RetrievedMemory[], RetrievedMemory[]>;
102
+ nextAgent: import("@langchain/langgraph").BinaryOperatorAggregate<AgentRole | "end" | null, AgentRole | "end" | null>;
103
+ response: import("@langchain/langgraph").BinaryOperatorAggregate<string, string>;
104
+ error: import("@langchain/langgraph").BinaryOperatorAggregate<string | null, string | null>;
105
+ }, import("@langchain/langgraph").StateDefinition>;
106
+ export declare function runOrchestrator(input: string, context?: Record<string, unknown>, memories?: RetrievedMemory[]): Promise<GraphState>;
107
+ export declare function streamOrchestrator(input: string, context?: Record<string, unknown>, memories?: RetrievedMemory[]): AsyncGenerator<{
108
+ node: string;
109
+ state: Partial<GraphState>;
110
+ }, void, unknown>;
111
+ declare const _default: {
112
+ createOrchestratorGraph: typeof createOrchestratorGraph;
113
+ getOrchestratorGraph: typeof getOrchestratorGraph;
114
+ runOrchestrator: typeof runOrchestrator;
115
+ streamOrchestrator: typeof streamOrchestrator;
116
+ };
117
+ export default _default;
118
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/core/orchestrator/graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAA0C,MAAM,0BAA0B,CAAC;AAI/F,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,UAAU,EACV,eAAe,EACf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAM5B,eAAO,MAAM,oBAAoB;;;;;;;;;;;EAgE/B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,OAAO,oBAAoB,CAAC,KAAK,CAAC;AAiI3D,wBAAgB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDA4BtC;AAKD,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAKnC;AAGD,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,eAAe,EAAO,GAC/B,OAAO,CAAC,UAAU,CAAC,CAoBrB;AAGD,wBAAuB,kBAAkB,CACvC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,eAAe,EAAO,GAC/B,cAAc,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAiB7E;;;;;;;AAED,wBAAsG"}