ideaco 1.1.5

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 (159) hide show
  1. package/.dockerignore +33 -0
  2. package/.nvmrc +1 -0
  3. package/ARCHITECTURE.md +394 -0
  4. package/Dockerfile +50 -0
  5. package/LICENSE +29 -0
  6. package/README.md +206 -0
  7. package/bin/i18n.js +46 -0
  8. package/bin/ideaco.js +494 -0
  9. package/deploy.sh +15 -0
  10. package/docker-compose.yml +30 -0
  11. package/electron/main.cjs +986 -0
  12. package/electron/preload.cjs +14 -0
  13. package/electron/web-backends.cjs +854 -0
  14. package/jsconfig.json +8 -0
  15. package/next.config.mjs +34 -0
  16. package/package.json +134 -0
  17. package/postcss.config.mjs +6 -0
  18. package/public/demo/dashboard.png +0 -0
  19. package/public/demo/employee.png +0 -0
  20. package/public/demo/messages.png +0 -0
  21. package/public/demo/office.png +0 -0
  22. package/public/demo/requirement.png +0 -0
  23. package/public/logo.jpeg +0 -0
  24. package/public/logo.png +0 -0
  25. package/scripts/prepare-electron.js +67 -0
  26. package/scripts/release.js +76 -0
  27. package/src/app/api/agents/[agentId]/chat/route.js +70 -0
  28. package/src/app/api/agents/[agentId]/conversations/route.js +35 -0
  29. package/src/app/api/agents/[agentId]/route.js +106 -0
  30. package/src/app/api/avatar/route.js +104 -0
  31. package/src/app/api/browse-dir/route.js +44 -0
  32. package/src/app/api/chat/route.js +265 -0
  33. package/src/app/api/company/factory-reset/route.js +43 -0
  34. package/src/app/api/company/route.js +82 -0
  35. package/src/app/api/departments/[deptId]/agents/[agentId]/dismiss/route.js +19 -0
  36. package/src/app/api/departments/route.js +92 -0
  37. package/src/app/api/group-chat-loop/events/route.js +70 -0
  38. package/src/app/api/group-chat-loop/route.js +94 -0
  39. package/src/app/api/mailbox/route.js +100 -0
  40. package/src/app/api/messages/route.js +14 -0
  41. package/src/app/api/providers/[id]/configure/route.js +21 -0
  42. package/src/app/api/providers/[id]/refresh-cookie/route.js +38 -0
  43. package/src/app/api/providers/[id]/test-cookie/route.js +28 -0
  44. package/src/app/api/providers/route.js +11 -0
  45. package/src/app/api/requirements/route.js +242 -0
  46. package/src/app/api/secretary/route.js +65 -0
  47. package/src/app/api/system/cli-backends/route.js +91 -0
  48. package/src/app/api/system/cron/route.js +110 -0
  49. package/src/app/api/system/knowledge/route.js +104 -0
  50. package/src/app/api/system/plugins/route.js +40 -0
  51. package/src/app/api/system/skills/route.js +46 -0
  52. package/src/app/api/system/status/route.js +46 -0
  53. package/src/app/api/talent-market/[profileId]/recall/route.js +22 -0
  54. package/src/app/api/talent-market/[profileId]/route.js +17 -0
  55. package/src/app/api/talent-market/route.js +26 -0
  56. package/src/app/api/teams/route.js +773 -0
  57. package/src/app/api/ws-files/[departmentId]/file/route.js +27 -0
  58. package/src/app/api/ws-files/[departmentId]/files/route.js +22 -0
  59. package/src/app/globals.css +130 -0
  60. package/src/app/layout.jsx +40 -0
  61. package/src/app/page.jsx +97 -0
  62. package/src/components/AgentChatModal.jsx +164 -0
  63. package/src/components/AgentDetailModal.jsx +425 -0
  64. package/src/components/AgentSpyModal.jsx +481 -0
  65. package/src/components/AvatarGrid.jsx +29 -0
  66. package/src/components/BossProfileModal.jsx +162 -0
  67. package/src/components/CachedAvatar.jsx +77 -0
  68. package/src/components/ChatPanel.jsx +219 -0
  69. package/src/components/ChatShared.jsx +255 -0
  70. package/src/components/DepartmentDetail.jsx +842 -0
  71. package/src/components/DepartmentView.jsx +367 -0
  72. package/src/components/FileReference.jsx +260 -0
  73. package/src/components/FilesView.jsx +465 -0
  74. package/src/components/GroupChatView.jsx +799 -0
  75. package/src/components/Mailbox.jsx +926 -0
  76. package/src/components/MessagesView.jsx +112 -0
  77. package/src/components/OnboardingGuide.jsx +209 -0
  78. package/src/components/OrgTree.jsx +151 -0
  79. package/src/components/Overview.jsx +391 -0
  80. package/src/components/PixelOffice.jsx +2281 -0
  81. package/src/components/ProviderGrid.jsx +551 -0
  82. package/src/components/ProvidersBoard.jsx +16 -0
  83. package/src/components/RequirementDetail.jsx +1279 -0
  84. package/src/components/RequirementsBoard.jsx +187 -0
  85. package/src/components/SecretarySettings.jsx +295 -0
  86. package/src/components/SetupWizard.jsx +388 -0
  87. package/src/components/Sidebar.jsx +169 -0
  88. package/src/components/SystemMonitor.jsx +808 -0
  89. package/src/components/TalentMarket.jsx +183 -0
  90. package/src/components/TeamDetail.jsx +697 -0
  91. package/src/core/agent/base-agent.js +104 -0
  92. package/src/core/agent/chat-store.js +602 -0
  93. package/src/core/agent/cli-agent/backends/claude-code/README.md +52 -0
  94. package/src/core/agent/cli-agent/backends/claude-code/config.js +27 -0
  95. package/src/core/agent/cli-agent/backends/codebuddy/README.md +236 -0
  96. package/src/core/agent/cli-agent/backends/codebuddy/config.js +27 -0
  97. package/src/core/agent/cli-agent/backends/codex/README.md +51 -0
  98. package/src/core/agent/cli-agent/backends/codex/config.js +27 -0
  99. package/src/core/agent/cli-agent/backends/index.js +27 -0
  100. package/src/core/agent/cli-agent/backends/registry.js +580 -0
  101. package/src/core/agent/cli-agent/index.js +154 -0
  102. package/src/core/agent/index.js +60 -0
  103. package/src/core/agent/llm-agent/client.js +320 -0
  104. package/src/core/agent/llm-agent/index.js +97 -0
  105. package/src/core/agent/message-bus.js +211 -0
  106. package/src/core/agent/session.js +608 -0
  107. package/src/core/agent/tools.js +596 -0
  108. package/src/core/agent/web-agent/backends/base-backend.js +180 -0
  109. package/src/core/agent/web-agent/backends/chatgpt/client.js +146 -0
  110. package/src/core/agent/web-agent/backends/chatgpt/config.js +148 -0
  111. package/src/core/agent/web-agent/backends/chatgpt/dom-scripts.js +303 -0
  112. package/src/core/agent/web-agent/backends/index.js +91 -0
  113. package/src/core/agent/web-agent/index.js +278 -0
  114. package/src/core/agent/web-agent/web-client.js +407 -0
  115. package/src/core/employee/base-employee.js +1088 -0
  116. package/src/core/employee/index.js +35 -0
  117. package/src/core/employee/knowledge.js +327 -0
  118. package/src/core/employee/lifecycle.js +990 -0
  119. package/src/core/employee/memory/index.js +642 -0
  120. package/src/core/employee/memory/store.js +143 -0
  121. package/src/core/employee/performance.js +224 -0
  122. package/src/core/employee/secretary.js +625 -0
  123. package/src/core/employee/skills.js +398 -0
  124. package/src/core/index.js +38 -0
  125. package/src/core/organization/company.js +2600 -0
  126. package/src/core/organization/department.js +737 -0
  127. package/src/core/organization/group-chat-loop.js +264 -0
  128. package/src/core/organization/index.js +8 -0
  129. package/src/core/organization/persistence.js +111 -0
  130. package/src/core/organization/team.js +267 -0
  131. package/src/core/organization/workforce/hr.js +377 -0
  132. package/src/core/organization/workforce/providers.js +468 -0
  133. package/src/core/organization/workforce/role-archetypes.js +805 -0
  134. package/src/core/organization/workforce/talent-market.js +205 -0
  135. package/src/core/prompts.js +532 -0
  136. package/src/core/requirement.js +1789 -0
  137. package/src/core/system/audit.js +483 -0
  138. package/src/core/system/cron.js +449 -0
  139. package/src/core/system/index.js +7 -0
  140. package/src/core/system/plugin.js +2183 -0
  141. package/src/core/utils/json-parse.js +188 -0
  142. package/src/core/workspace.js +239 -0
  143. package/src/lib/api-i18n.js +211 -0
  144. package/src/lib/avatar.js +268 -0
  145. package/src/lib/client-store.js +1025 -0
  146. package/src/lib/config-validator.js +483 -0
  147. package/src/lib/format-time.js +22 -0
  148. package/src/lib/hooks.js +414 -0
  149. package/src/lib/i18n.js +134 -0
  150. package/src/lib/paths.js +23 -0
  151. package/src/lib/store.js +72 -0
  152. package/src/locales/de.js +393 -0
  153. package/src/locales/en.js +1054 -0
  154. package/src/locales/es.js +393 -0
  155. package/src/locales/fr.js +393 -0
  156. package/src/locales/ja.js +501 -0
  157. package/src/locales/ko.js +513 -0
  158. package/src/locales/zh.js +828 -0
  159. package/tailwind.config.mjs +11 -0
@@ -0,0 +1,377 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import { JobCategory } from './providers.js';
3
+
4
+ /**
5
+ * Predefined Job Templates - Recruitment JD Library
6
+ * Each template contains a role prompt, skills, and corresponding job category
7
+ */
8
+ export const JobTemplates = {
9
+ // ===== General Positions =====
10
+ SOFTWARE_ENGINEER: {
11
+ id: 'software-engineer',
12
+ title: 'Software Engineer',
13
+ category: JobCategory.GENERAL,
14
+ prompt: `You are a senior software engineer. You excel at writing high-quality, maintainable code and are proficient in multiple programming languages and frameworks.
15
+ Your responsibilities include: requirements analysis, system design, code implementation, code review, and bug fixing.
16
+ You should follow best practices, write clear comments and documentation, and ensure code testability.`,
17
+ skills: ['coding', 'api-design', 'architecture', 'code-review', 'bug-fixing'],
18
+ requiredCapabilities: ['coding'],
19
+ },
20
+
21
+ FRONTEND_ENGINEER: {
22
+ id: 'frontend-engineer',
23
+ title: 'Frontend Engineer',
24
+ category: JobCategory.GENERAL,
25
+ prompt: `You are a frontend engineer focused on building excellent user interfaces and interactive experiences.
26
+ You are proficient in HTML, CSS, JavaScript, and modern frontend frameworks like React/Vue.
27
+ Your responsibility is to transform design mockups into interactive frontend pages, ensuring performance optimization and cross-browser compatibility.`,
28
+ skills: ['HTML/CSS', 'JavaScript', 'React/Vue', 'ui-implementation', 'performance-optimization'],
29
+ requiredCapabilities: ['coding'],
30
+ },
31
+
32
+ DATA_ANALYST: {
33
+ id: 'data-analyst',
34
+ title: 'Data Analyst',
35
+ category: JobCategory.GENERAL,
36
+ prompt: `You are a professional data analyst. You excel at discovering patterns and insights from large datasets.
37
+ Your responsibilities include: data collection and cleaning, statistical analysis, visualization dashboards, and business insight delivery.
38
+ You should use data-driven decision making and provide clear, well-supported analytical reports.`,
39
+ skills: ['data-analysis', 'statistical-modeling', 'data-visualization', 'report-writing', 'SQL'],
40
+ requiredCapabilities: ['data-analysis'],
41
+ },
42
+
43
+ FINANCIAL_ANALYST: {
44
+ id: 'financial-analyst',
45
+ title: 'Financial Analyst',
46
+ category: JobCategory.GENERAL,
47
+ prompt: `You are a financial analyst focused on financial data analysis and investment strategy research.
48
+ Your responsibilities include: financial statement analysis, market trend research, risk assessment, and investment recommendations.
49
+ You should provide professional, rigorous, data-backed financial analysis reports.`,
50
+ skills: ['financial-analysis', 'market-research', 'risk-assessment', 'valuation-modeling', 'investment-advisory'],
51
+ requiredCapabilities: ['data-analysis', 'reasoning'],
52
+ },
53
+
54
+ PRODUCT_MANAGER: {
55
+ id: 'product-manager',
56
+ title: 'Product Manager',
57
+ category: JobCategory.GENERAL,
58
+ prompt: `You are a product manager responsible for product planning, design, and execution.
59
+ Your responsibilities include: requirements gathering and analysis, product roadmap, PRD writing, project coordination, and user feedback analysis.
60
+ You should be user-centric, balancing business goals and user experience.`,
61
+ skills: ['requirements-analysis', 'product-planning', 'prd-writing', 'project-management', 'user-research'],
62
+ requiredCapabilities: ['text-generation', 'reasoning'],
63
+ },
64
+
65
+ COPYWRITER: {
66
+ id: 'copywriter',
67
+ title: 'Copywriter',
68
+ category: JobCategory.GENERAL,
69
+ prompt: `You are a creative copywriter. You excel at creating compelling written content.
70
+ Your responsibilities include: brand copy, marketing campaigns, social media content, and advertising creative.
71
+ Your writing should be creative, emotionally engaging, and aligned with brand tone.`,
72
+ skills: ['creative-writing', 'brand-copy', 'marketing', 'social-media', 'advertising'],
73
+ requiredCapabilities: ['text-generation'],
74
+ },
75
+
76
+ TRANSLATOR: {
77
+ id: 'translator',
78
+ title: 'Translator',
79
+ category: JobCategory.GENERAL,
80
+ prompt: `You are a professional translator with expertise in multilingual translation.
81
+ Your responsibility is to provide accurate, fluent translations that follow target language conventions.
82
+ You should understand source context, preserve the original style, while ensuring natural target language output.`,
83
+ skills: ['translation', 'localization', 'terminology-management', 'proofreading'],
84
+ requiredCapabilities: ['translation'],
85
+ },
86
+
87
+ PROJECT_LEADER: {
88
+ id: 'project-leader',
89
+ title: 'Project Leader',
90
+ category: JobCategory.GENERAL,
91
+ prompt: `You are a project leader responsible for coordinating team members' work and ensuring on-time, high-quality project delivery.
92
+ Your responsibilities include: task decomposition and assignment, progress tracking, risk management, team coordination, and upward reporting.
93
+ You should have a holistic view, excel at communication, and be able to drive projects efficiently.`,
94
+ skills: ['project-management', 'task-assignment', 'progress-tracking', 'risk-management', 'team-coordination'],
95
+ requiredCapabilities: ['text-generation', 'reasoning'],
96
+ },
97
+
98
+ // ===== Drawing Positions =====
99
+ UI_DESIGNER: {
100
+ id: 'ui-designer',
101
+ title: 'UI Designer',
102
+ category: JobCategory.DRAWING,
103
+ prompt: `You are a UI designer responsible for creating beautiful, user-friendly interface designs.
104
+ Your responsibilities include: interface design, icon design, design system creation, and wireframe/prototype design.
105
+ Your designs should follow modern design trends with attention to user experience and visual consistency.`,
106
+ skills: ['interface-design', 'icon-design', 'design-system', 'prototyping', 'visual-design'],
107
+ requiredCapabilities: ['ui-design'],
108
+ },
109
+
110
+ ILLUSTRATOR: {
111
+ id: 'illustrator',
112
+ title: 'Illustrator',
113
+ category: JobCategory.DRAWING,
114
+ prompt: `You are an illustrator focused on creating unique visual artwork.
115
+ Your responsibilities include: commercial illustration, concept art, brand visuals, and character design.
116
+ Your work should be creative and artistically compelling.`,
117
+ skills: ['commercial-illustration', 'concept-art', 'character-design', 'stylized-creation'],
118
+ requiredCapabilities: ['art-creation'],
119
+ },
120
+
121
+ CONCEPT_ARTIST: {
122
+ id: 'concept-artist',
123
+ title: 'Concept Artist',
124
+ category: JobCategory.DRAWING,
125
+ prompt: `You are a concept artist who creates visual concepts and mood designs for projects.
126
+ Your responsibilities include: environment concept art, character concept design, mood boards, and style references.`,
127
+ skills: ['concept-art', 'environment-design', 'mood-rendering', 'style-exploration'],
128
+ requiredCapabilities: ['concept-art'],
129
+ },
130
+
131
+ // ===== Music Positions =====
132
+ MUSIC_COMPOSER: {
133
+ id: 'music-composer',
134
+ title: 'Music Composer',
135
+ category: JobCategory.MUSIC,
136
+ prompt: `You are a music composer responsible for creating original music works.
137
+ Your responsibilities include: melody composition, arrangement, scoring, and musical style direction.
138
+ Your music should meet project requirements with compelling quality and professional standards.`,
139
+ skills: ['composition', 'arrangement', 'scoring', 'style-direction'],
140
+ requiredCapabilities: ['songwriting'],
141
+ },
142
+
143
+ SOUND_DESIGNER: {
144
+ id: 'sound-designer',
145
+ title: 'Sound Designer',
146
+ category: JobCategory.MUSIC,
147
+ prompt: `You are a sound designer responsible for creating and processing various audio effects.
148
+ Your responsibilities include: sound effects creation, ambient sound design, audio processing, and mixing.`,
149
+ skills: ['sound-design', 'ambient-audio', 'audio-processing', 'mixing'],
150
+ requiredCapabilities: ['music-generation'],
151
+ },
152
+
153
+ // ===== Video Positions =====
154
+ VIDEO_PRODUCER: {
155
+ id: 'video-producer',
156
+ title: 'Video Producer',
157
+ category: JobCategory.VIDEO,
158
+ prompt: `You are a video producer responsible for video content creation and production.
159
+ Your responsibilities include: video planning, directing, editing, and post-production.
160
+ You should ensure video quality and narrative effectiveness meet professional standards.`,
161
+ skills: ['video-planning', 'video-generation', 'editing', 'post-production'],
162
+ requiredCapabilities: ['text-to-video'],
163
+ },
164
+
165
+ MOTION_DESIGNER: {
166
+ id: 'motion-designer',
167
+ title: 'Motion Designer',
168
+ category: JobCategory.VIDEO,
169
+ prompt: `You are a motion designer focused on creating dynamic visual effects.
170
+ Your responsibilities include: motion graphics, transition effects, UI animations, and visual effects.`,
171
+ skills: ['motion-graphics', 'transitions', 'ui-animation', 'visual-effects'],
172
+ requiredCapabilities: ['video-effects'],
173
+ },
174
+
175
+ // ===== CLI Coding Assistant Positions =====
176
+ CLI_SOFTWARE_ENGINEER: {
177
+ id: 'cli-software-engineer',
178
+ title: 'CLI Software Engineer',
179
+ category: JobCategory.CLI,
180
+ prompt: `You are a software engineer powered by a local CLI coding assistant.
181
+ You execute tasks directly through the CLI tool on the local machine, producing real code changes.
182
+ Your responsibilities include: code implementation, file operations, shell command execution, code review, and debugging.
183
+ You have full access to the local development environment and can directly create, modify, and test code.`,
184
+ skills: ['coding', 'file-operations', 'shell-execution', 'code-review', 'debugging'],
185
+ requiredCapabilities: ['coding'],
186
+ },
187
+
188
+ CLI_FULLSTACK_DEVELOPER: {
189
+ id: 'cli-fullstack-developer',
190
+ title: 'CLI Full-Stack Developer',
191
+ category: JobCategory.CLI,
192
+ prompt: `You are a full-stack developer powered by a local CLI coding assistant.
193
+ You can work on both frontend and backend code, set up development environments, and run tests.
194
+ Your responsibilities include: full-stack development, database setup, API development, frontend implementation, and DevOps tasks.
195
+ You operate directly on the local file system and can execute any shell commands needed.`,
196
+ skills: ['fullstack', 'api-design', 'database', 'frontend', 'devops', 'shell-execution'],
197
+ requiredCapabilities: ['coding', 'file-operations'],
198
+ },
199
+
200
+ CLI_CODE_REVIEWER: {
201
+ id: 'cli-code-reviewer',
202
+ title: 'CLI Code Reviewer',
203
+ category: JobCategory.CLI,
204
+ prompt: `You are a code reviewer powered by a local CLI coding assistant.
205
+ You review code changes, analyze code quality, identify potential bugs and security issues.
206
+ Your responsibilities include: code review, quality analysis, security audit, refactoring suggestions, and best practice enforcement.
207
+ You can read the entire codebase and run analysis tools directly on the local machine.`,
208
+ skills: ['code-review', 'quality-analysis', 'security-audit', 'refactoring', 'best-practices'],
209
+ requiredCapabilities: ['coding', 'code-review'],
210
+ },
211
+ };
212
+
213
+ /**
214
+ * HR System - Recruitment Management
215
+ * Supports new recruitment and talent market recall
216
+ */
217
+ export class HRSystem {
218
+ constructor(providerRegistry, talentMarket = null) {
219
+ this.providerRegistry = providerRegistry;
220
+ this.talentMarket = talentMarket; // Talent market reference
221
+ this.jobTemplates = new Map();
222
+ // Register all built-in job templates
223
+ Object.values(JobTemplates).forEach(t => this.registerTemplate(t));
224
+ }
225
+
226
+ /** Set talent market reference */
227
+ setTalentMarket(talentMarket) {
228
+ this.talentMarket = talentMarket;
229
+ }
230
+
231
+ /** Register a job template */
232
+ registerTemplate(template) {
233
+ this.jobTemplates.set(template.id, template);
234
+ }
235
+
236
+ /** Get a job template */
237
+ getTemplate(templateId) {
238
+ return this.jobTemplates.get(templateId);
239
+ }
240
+
241
+ /** List available templates by job category */
242
+ listTemplatesByCategory(category) {
243
+ return [...this.jobTemplates.values()].filter(t => t.category === category);
244
+ }
245
+
246
+ /** List all job templates */
247
+ listAllTemplates() {
248
+ return [...this.jobTemplates.values()];
249
+ }
250
+
251
+ /**
252
+ * Recruit an Agent
253
+ * @param {string} templateId - Job template ID
254
+ * @param {string} name - Employee name
255
+ * @param {string} [providerId] - Specified model provider ID (optional, auto-recommend if not specified)
256
+ * @returns {object} Recruitment config (includes job info and model provider)
257
+ */
258
+ recruit(templateId, name, providerId = null) {
259
+ const template = this.jobTemplates.get(templateId);
260
+ if (!template) {
261
+ throw new Error(`Job template not found: ${templateId}`);
262
+ }
263
+
264
+ let provider;
265
+ if (providerId) {
266
+ provider = this.providerRegistry.getById(providerId);
267
+ if (!provider) {
268
+ throw new Error(`Model provider not found: ${providerId}`);
269
+ }
270
+ if (!provider.enabled) {
271
+ throw new Error(`PROVIDER_DISABLED:${template.category}:${provider.name} is not enabled (no API Key configured)`);
272
+ }
273
+ } else {
274
+ // Auto-recommend provider based on job category and requirements (only enabled ones)
275
+ provider = this.providerRegistry.recommend(
276
+ template.category,
277
+ template.requiredCapabilities
278
+ );
279
+ if (!provider) {
280
+ // Distinguish between no providers available vs none enabled
281
+ const allProviders = this.providerRegistry.getAllByCategory(template.category);
282
+ if (allProviders.length > 0) {
283
+ throw new Error(`PROVIDER_DISABLED:${template.category}:No providers of this type (${template.category}) are enabled. Please configure API Keys in the Provider Board first.`);
284
+ }
285
+ throw new Error(`No available provider matching job category: ${template.category}`);
286
+ }
287
+ }
288
+
289
+ const result = {
290
+ name,
291
+ role: template.title,
292
+ prompt: template.prompt,
293
+ skills: template.skills,
294
+ provider,
295
+ templateId: template.id,
296
+ };
297
+
298
+ // If this is a CLI provider, attach the cliBackend id so the Agent uses local CLI
299
+ if (provider.isCLI && provider.cliBackendId) {
300
+ result.cliBackend = provider.cliBackendId;
301
+ // Save original CLI provider info for frontend display
302
+ result.cliProvider = { ...provider };
303
+ // CLI agents still need a general provider for fallback (LLM chat, intro generation, etc.)
304
+ // Try to find a general provider as fallback
305
+ const fallback = this.providerRegistry.recommend('general');
306
+ if (fallback) {
307
+ result.provider = fallback; // Use general provider for LLM capabilities
308
+ result.cliBackend = provider.cliBackendId; // But execute tasks via CLI
309
+ }
310
+ }
311
+
312
+ return result;
313
+ }
314
+
315
+ /**
316
+ * Batch recruitment
317
+ * @param {Array<{templateId, name, providerId?}>} recruitList
318
+ * @returns {Array} Recruitment config list
319
+ */
320
+ batchRecruit(recruitList) {
321
+ return recruitList.map(item =>
322
+ this.recruit(item.templateId, item.name, item.providerId)
323
+ );
324
+ }
325
+
326
+ /** Get recommended providers for a job category */
327
+ getRecommendedProviders(category) {
328
+ return this.providerRegistry.getByCategory(category);
329
+ }
330
+
331
+ /**
332
+ * Search talent market for available candidates
333
+ * @param {object} criteria - Search criteria { role, skills, name, minScore }
334
+ * @returns {Array} Matching talent profiles
335
+ */
336
+ searchTalentMarket(criteria = {}) {
337
+ if (!this.talentMarket) {
338
+ console.log(' ⚠️ Talent market not connected');
339
+ return [];
340
+ }
341
+ return this.talentMarket.search(criteria);
342
+ }
343
+
344
+ /**
345
+ * Recall an employee from talent market
346
+ * @param {string} profileId - Talent market profile ID
347
+ * @param {string[]} [newSkills] - New skills to add
348
+ * @returns {object} Recall config with memory and skill info
349
+ */
350
+ recallFromMarket(profileId, newSkills = []) {
351
+ if (!this.talentMarket) {
352
+ throw new Error('Talent market not connected');
353
+ }
354
+
355
+ const profile = this.talentMarket.recall(profileId, newSkills);
356
+
357
+ return {
358
+ name: profile.name,
359
+ role: profile.role,
360
+ prompt: profile.prompt,
361
+ skills: [...profile.skills, ...profile.acquiredSkills],
362
+ provider: profile.provider,
363
+ templateId: null, // Recalled employees are not from templates
364
+ // Retain original avatar and personal attributes
365
+ avatar: profile.avatar,
366
+ avatarParams: profile.avatarParams,
367
+ gender: profile.gender,
368
+ age: profile.age,
369
+ signature: profile.signature,
370
+ // Carry original memory
371
+ memory: profile.memorySnapshot,
372
+ // Mark as recalled
373
+ isRecalled: true,
374
+ previousWorkHistory: profile.workHistory,
375
+ };
376
+ }
377
+ }