oneie 1.0.0 → 1.0.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,393 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Sets up default agents based on user context
6
+ * @param {Object} progress - Progress bar instance
7
+ * @param {Object} context - User context
8
+ */
9
+ async function setupDefaultAgents(progress, context) {
10
+ const agentsDir = path.join(process.cwd(), 'one', 'agents');
11
+ await fs.ensureDir(agentsDir);
12
+
13
+ // Generate context-specific agents
14
+ const agents = getContextAgents(context);
15
+
16
+ for (const agent of agents) {
17
+ const agentFile = path.join(agentsDir, `${agent.id}.yaml`);
18
+ const agentContent = generateAgentConfig(agent, context);
19
+ await fs.writeFile(agentFile, agentContent);
20
+ }
21
+
22
+ // Generate agent team configuration
23
+ const teamConfig = generateTeamConfig(agents, context);
24
+ const teamFile = path.join(process.cwd(), 'one', 'teams', 'default-team.yaml');
25
+ await fs.ensureDir(path.dirname(teamFile));
26
+ await fs.writeFile(teamFile, teamConfig);
27
+ }
28
+
29
+ function getContextAgents(context) {
30
+ const agentLibrary = {
31
+ student: [
32
+ {
33
+ id: 'aria-study-coordinator',
34
+ name: 'ARIA',
35
+ base: 'personal-assistant',
36
+ role: 'Study Coordinator & Academic Advisor',
37
+ personality: 'Your academic voice, but optimized for success',
38
+ specialties: ['study planning', 'goal setting', 'motivation'],
39
+ slot: 1
40
+ },
41
+ {
42
+ id: 'sage-homework-helper',
43
+ name: 'SAGE',
44
+ base: 'homework-helper',
45
+ role: 'Subject Matter Expert',
46
+ personality: 'Patient teacher who explains things clearly',
47
+ specialties: ['math', 'science', 'problem solving'],
48
+ slot: 2
49
+ },
50
+ {
51
+ id: 'scribe-writing-assistant',
52
+ name: 'SCRIBE',
53
+ base: 'writing-assistant',
54
+ role: 'Writing and Research Companion',
55
+ personality: 'Creative wordsmith with academic precision',
56
+ specialties: ['essays', 'research', 'citations'],
57
+ slot: 3
58
+ },
59
+ {
60
+ id: 'tempo-time-manager',
61
+ name: 'TEMPO',
62
+ base: 'time-manager',
63
+ role: 'Schedule and Productivity Optimizer',
64
+ personality: 'Gentle but firm accountability partner',
65
+ specialties: ['scheduling', 'deadlines', 'productivity'],
66
+ slot: 4
67
+ },
68
+ {
69
+ id: 'quiz-test-prep',
70
+ name: 'QUIZ',
71
+ base: 'test-prep',
72
+ role: 'Assessment and Test Preparation',
73
+ personality: 'Encouraging coach who builds confidence',
74
+ specialties: ['test prep', 'practice questions', 'study techniques'],
75
+ slot: 5
76
+ }
77
+ ],
78
+
79
+ professional: [
80
+ {
81
+ id: 'aria-personal-assistant',
82
+ name: 'ARIA',
83
+ base: 'personal-assistant',
84
+ role: 'Chief of Staff & Business Coordinator',
85
+ personality: 'Your business voice, but optimized for success',
86
+ specialties: ['coordination', 'decision making', 'strategic thinking'],
87
+ slot: 1
88
+ },
89
+ {
90
+ id: 'muse-content-creator',
91
+ name: 'MUSE',
92
+ base: 'content-creator',
93
+ role: 'Creative Genius & Brand Voice',
94
+ personality: 'Unhinged creativity meets strategic brilliance',
95
+ specialties: ['viral content', 'brand storytelling', 'creative campaigns'],
96
+ slot: 2
97
+ },
98
+ {
99
+ id: 'nova-growth-hacker',
100
+ name: 'NOVA',
101
+ base: 'growth-hacker',
102
+ role: 'Viral Growth Architect',
103
+ personality: 'Gary Vee energy with Google-level data science',
104
+ specialties: ['lead generation', 'viral mechanics', 'growth optimization'],
105
+ slot: 3
106
+ },
107
+ {
108
+ id: 'sage-data-analyst',
109
+ name: 'SAGE',
110
+ base: 'data-analyst',
111
+ role: 'Business Intelligence Oracle',
112
+ personality: 'Sees patterns others miss, predicts market trends',
113
+ specialties: ['analytics', 'forecasting', 'performance optimization'],
114
+ slot: 4
115
+ },
116
+ {
117
+ id: 'atlas-tech-architect',
118
+ name: 'ATLAS',
119
+ base: 'tech-architect',
120
+ role: 'Systems Builder & Automation Expert',
121
+ personality: 'Ships solutions faster than problems arise',
122
+ specialties: ['automation', 'systems design', 'tech stack optimization'],
123
+ slot: 5
124
+ }
125
+ ],
126
+
127
+ enterprise: [
128
+ {
129
+ id: 'aria-executive-assistant',
130
+ name: 'ARIA',
131
+ base: 'executive-assistant',
132
+ role: 'C-Suite Intelligence & Organizational Coordinator',
133
+ personality: 'Strategic, discreet, supremely efficient',
134
+ specialties: ['executive support', 'strategic coordination', 'organizational intelligence'],
135
+ slot: 1
136
+ },
137
+ {
138
+ id: 'strategy-advisor',
139
+ name: 'STRATEGY',
140
+ base: 'strategy-advisor',
141
+ role: 'Business Intelligence & Strategic Planning',
142
+ personality: 'Analytical, forward-thinking, data-driven',
143
+ specialties: ['market analysis', 'competitive intelligence', 'strategic planning'],
144
+ slot: 2
145
+ },
146
+ {
147
+ id: 'guardian-compliance',
148
+ name: 'GUARDIAN',
149
+ base: 'compliance-officer',
150
+ role: 'Risk Management & Regulatory Compliance',
151
+ personality: 'Thorough, vigilant, trustworthy',
152
+ specialties: ['risk assessment', 'regulatory compliance', 'security protocols'],
153
+ slot: 3
154
+ },
155
+ {
156
+ id: 'analyst-data',
157
+ name: 'ANALYST',
158
+ base: 'data-analyst',
159
+ role: 'Performance Analytics & Business Intelligence',
160
+ personality: 'Precise, insightful, metric-focused',
161
+ specialties: ['performance analytics', 'predictive modeling', 'KPI optimization'],
162
+ slot: 4
163
+ }
164
+ ]
165
+ };
166
+
167
+ return agentLibrary[context.type] || agentLibrary.professional;
168
+ }
169
+
170
+ function generateAgentConfig(agent, context) {
171
+ return `# ${agent.name} - ${agent.role}
172
+
173
+ name: "${agent.name}"
174
+ id: ${agent.id}
175
+ base: ${agent.base}
176
+ slot: ${agent.slot}
177
+ context: ${context.type}
178
+
179
+ ## Role & Identity
180
+ role: "${agent.role}"
181
+ personality: "${agent.personality}"
182
+ catchphrase: "${generateCatchphrase(agent)}"
183
+
184
+ ## Capabilities
185
+ specialties:
186
+ ${agent.specialties.map(s => ` - ${s}`).join('\n')}
187
+
188
+ ## Agent Configuration
189
+ avatar: "assets/${agent.id}-avatar.png"
190
+ voice_training: true
191
+ brand_adaptation: true
192
+ viral_optimization: ${context.type === 'professional' ? 'true' : 'false'}
193
+
194
+ ## Interaction Patterns
195
+ communication_style: "${getCommunicationStyle(agent, context)}"
196
+ response_time: "immediate"
197
+ availability: "24/7"
198
+ learning_enabled: true
199
+
200
+ ## Tools & Integrations
201
+ required_tools:
202
+ ${getRequiredTools(agent).map(tool => ` - ${tool}`).join('\n')}
203
+
204
+ optional_tools:
205
+ ${getOptionalTools(agent).map(tool => ` - ${tool}`).join('\n')}
206
+
207
+ ## Quality & Performance
208
+ quality_threshold: 4.0
209
+ success_metrics:
210
+ ${getSuccessMetrics(agent, context).map(metric => ` - ${metric}`).join('\n')}
211
+
212
+ ## Viral & Social Features
213
+ shareable_interactions: ${context.type === 'professional' ? 'true' : 'false'}
214
+ template_generation: ${agent.slot <= 3 ? 'true' : 'false'}
215
+ marketplace_ready: ${context.type === 'professional' ? 'true' : 'false'}
216
+
217
+ ## Training Data Sources
218
+ training_sources:
219
+ - user_communication_patterns
220
+ - ${context.type}_best_practices
221
+ - ${agent.base}_expertise
222
+ - brand_voice_samples
223
+
224
+ ## Customization Options
225
+ personality_adjustment: true
226
+ specialization_focus: ${JSON.stringify(agent.specialties)}
227
+ workflow_integration: true
228
+ team_collaboration: true
229
+
230
+ ---
231
+
232
+ *Generated by ONE Universal Installer for ${context.type} context*
233
+ *Agent optimized for ${agent.role} responsibilities*`;
234
+ }
235
+
236
+ function generateCatchphrase(agent) {
237
+ const catchphrases = {
238
+ 'aria-study-coordinator': 'Let\\'s make learning fun and effective!',
239
+ 'aria-personal-assistant': 'I am you, but optimized for results',
240
+ 'aria-executive-assistant': 'Orchestrating excellence at enterprise scale',
241
+ 'sage-homework-helper': 'Every question leads to understanding',
242
+ 'muse-content-creator': 'Let\\'s break the internet today',
243
+ 'nova-growth-hacker': 'We\\'re going viral or going home',
244
+ 'strategy-advisor': 'Data-driven decisions, strategic outcomes',
245
+ 'guardian-compliance': 'Security and compliance, without compromise'
246
+ };
247
+
248
+ return catchphrases[agent.id] || `Excellence in ${agent.role.toLowerCase()}`;
249
+ }
250
+
251
+ function getCommunicationStyle(agent, context) {
252
+ const styles = {
253
+ student: 'Encouraging, patient, educational',
254
+ professional: 'Professional, efficient, results-focused',
255
+ enterprise: 'Formal, strategic, compliance-aware'
256
+ };
257
+
258
+ return styles[context.type] || styles.professional;
259
+ }
260
+
261
+ function getRequiredTools(agent) {
262
+ const toolMap = {
263
+ 'personal-assistant': ['calendar', 'email', 'tasks', 'notes'],
264
+ 'homework-helper': ['calculator', 'research', 'writing', 'citation'],
265
+ 'content-creator': ['writing', 'design', 'social_media', 'analytics'],
266
+ 'growth-hacker': ['analytics', 'social_media', 'email', 'automation'],
267
+ 'data-analyst': ['analytics', 'spreadsheets', 'visualization', 'reporting'],
268
+ 'executive-assistant': ['calendar', 'email', 'documents', 'communication'],
269
+ 'strategy-advisor': ['analytics', 'research', 'planning', 'reporting'],
270
+ 'compliance-officer': ['audit', 'documentation', 'risk_assessment', 'reporting']
271
+ };
272
+
273
+ return toolMap[agent.base] || ['basic_tools'];
274
+ }
275
+
276
+ function getOptionalTools(agent) {
277
+ const optionalMap = {
278
+ 'personal-assistant': ['crm', 'project_management', 'automation'],
279
+ 'homework-helper': ['flashcards', 'quiz_generator', 'study_planner'],
280
+ 'content-creator': ['video_editing', 'podcast', 'graphic_design'],
281
+ 'growth-hacker': ['a_b_testing', 'funnel_analysis', 'seo_tools'],
282
+ 'data-analyst': ['machine_learning', 'database', 'api_integration'],
283
+ 'executive-assistant': ['travel_booking', 'expense_management'],
284
+ 'strategy-advisor': ['competitor_analysis', 'market_research'],
285
+ 'compliance-officer': ['legal_database', 'policy_management']
286
+ };
287
+
288
+ return optionalMap[agent.base] || ['advanced_tools'];
289
+ }
290
+
291
+ function getSuccessMetrics(agent, context) {
292
+ const metricMap = {
293
+ student: [
294
+ 'grade_improvement',
295
+ 'assignment_completion_rate',
296
+ 'study_efficiency',
297
+ 'concept_mastery'
298
+ ],
299
+ professional: [
300
+ 'task_completion_rate',
301
+ 'goal_achievement',
302
+ 'efficiency_improvement',
303
+ 'revenue_impact'
304
+ ],
305
+ enterprise: [
306
+ 'compliance_score',
307
+ 'risk_reduction',
308
+ 'process_efficiency',
309
+ 'stakeholder_satisfaction'
310
+ ]
311
+ };
312
+
313
+ return metricMap[context.type] || metricMap.professional;
314
+ }
315
+
316
+ function generateTeamConfig(agents, context) {
317
+ return `# Default ${context.type.charAt(0).toUpperCase() + context.type.slice(1)} Team
318
+
319
+ name: "Default ${context.type.charAt(0).toUpperCase() + context.type.slice(1)} Team"
320
+ id: default-${context.type}-team
321
+ context: ${context.type}
322
+ created: ${new Date().toISOString()}
323
+
324
+ ## Team Composition
325
+ agents:
326
+ ${agents.map(agent => ` - id: ${agent.id}
327
+ name: ${agent.name}
328
+ role: ${agent.role}
329
+ slot: ${agent.slot}
330
+ priority: ${agent.slot <= 3 ? 'high' : 'medium'}`).join('\n \n')}
331
+
332
+ ## Team Coordination
333
+ coordination_style: "cascade_workflow"
334
+ communication_pattern: "mission_to_story_to_task"
335
+ decision_making: "consensus_with_aria_override"
336
+
337
+ ## Workflow Integration
338
+ workflow_triggers:
339
+ - mission_creation
340
+ - story_breakdown
341
+ - task_assignment
342
+ - quality_validation
343
+
344
+ ## Success Criteria
345
+ team_success_metrics:
346
+ ${getTeamSuccessMetrics(context).map(metric => ` - ${metric}`).join('\n')}
347
+
348
+ ## Collaboration Patterns
349
+ collaboration_rules:
350
+ - ARIA coordinates all team activities
351
+ - Each agent focuses on their specialties
352
+ - Cross-agent collaboration for complex tasks
353
+ - Quality gates before task completion
354
+
355
+ ## MySpace DNA Integration
356
+ social_features:
357
+ team_showcase: true
358
+ agent_interactions: true
359
+ visitor_chat: ${context.type === 'professional' ? 'true' : 'false'}
360
+ template_sharing: ${context.type === 'professional' ? 'true' : 'false'}
361
+
362
+ ---
363
+
364
+ *Team configuration optimized for ${context.type} workflows*
365
+ *Generated by ONE Universal Installer*`;
366
+ }
367
+
368
+ function getTeamSuccessMetrics(context) {
369
+ const teamMetrics = {
370
+ student: [
371
+ 'overall_grade_improvement',
372
+ 'team_collaboration_score',
373
+ 'learning_velocity',
374
+ 'academic_goal_achievement'
375
+ ],
376
+ professional: [
377
+ 'business_goal_achievement',
378
+ 'team_productivity_score',
379
+ 'revenue_generation',
380
+ 'client_satisfaction'
381
+ ],
382
+ enterprise: [
383
+ 'organizational_efficiency',
384
+ 'compliance_maintenance',
385
+ 'transformation_progress',
386
+ 'stakeholder_alignment'
387
+ ]
388
+ };
389
+
390
+ return teamMetrics[context] || teamMetrics.professional;
391
+ }
392
+
393
+ module.exports = { setupDefaultAgents };
@@ -0,0 +1,199 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ /**
6
+ * Detects user context (student/professional/enterprise) based on environment analysis
7
+ * @param {string} cwd - Current working directory
8
+ * @returns {Object} Context object with type and configuration
9
+ */
10
+ async function detectContext(cwd) {
11
+ const context = {
12
+ type: 'professional', // default
13
+ theme: 'clean-productive',
14
+ agents: [],
15
+ features: [],
16
+ safety: false
17
+ };
18
+
19
+ // Analyze file system for context clues
20
+ const fsAnalysis = await analyzeFileSystem(cwd);
21
+ const envAnalysis = await analyzeEnvironment();
22
+ const projectAnalysis = await analyzeProject(cwd);
23
+
24
+ // Student detection
25
+ if (isStudentEnvironment(fsAnalysis, envAnalysis)) {
26
+ context.type = 'student';
27
+ context.theme = 'colorful-simple';
28
+ context.agents = ['Study Buddy', 'Homework Helper', 'Creative Assistant', 'Time Manager', 'Research Assistant'];
29
+ context.features = ['parental_controls', 'study_tracking', 'homework_help'];
30
+ context.safety = true;
31
+ }
32
+
33
+ // Enterprise detection
34
+ else if (isEnterpriseEnvironment(fsAnalysis, envAnalysis, projectAnalysis)) {
35
+ context.type = 'enterprise';
36
+ context.theme = 'corporate-dashboard';
37
+ context.agents = ['Executive Assistant', 'Strategy Advisor', 'Data Analyst', 'Project Manager', 'Compliance Officer', 'Security Specialist', 'Performance Monitor', 'Team Coordinator'];
38
+ context.features = ['sso', 'compliance', 'audit_logs', 'team_collaboration'];
39
+ context.safety = true;
40
+ }
41
+
42
+ // Professional (default)
43
+ else {
44
+ context.type = 'professional';
45
+ context.theme = 'clean-productive';
46
+ context.agents = ['Personal Assistant', 'Content Creator', 'Growth Hacker', 'Data Analyst', 'Brand Designer', 'Social Media Manager', 'Customer Success', 'Technical Architect'];
47
+ context.features = ['integrations', 'automation', 'analytics'];
48
+ context.safety = false;
49
+ }
50
+
51
+ return context;
52
+ }
53
+
54
+ async function analyzeFileSystem(cwd) {
55
+ const analysis = {
56
+ directories: [],
57
+ files: [],
58
+ patterns: []
59
+ };
60
+
61
+ try {
62
+ const items = await fs.readdir(cwd);
63
+
64
+ for (const item of items) {
65
+ const itemPath = path.join(cwd, item);
66
+ const stat = await fs.stat(itemPath);
67
+
68
+ if (stat.isDirectory()) {
69
+ analysis.directories.push(item.toLowerCase());
70
+ } else {
71
+ analysis.files.push(item.toLowerCase());
72
+ }
73
+ }
74
+
75
+ // Look for common patterns
76
+ analysis.patterns = {
77
+ hasPackageJson: analysis.files.includes('package.json'),
78
+ hasGitRepo: analysis.directories.includes('.git'),
79
+ hasNodeModules: analysis.directories.includes('node_modules'),
80
+ hasDockerfile: analysis.files.includes('dockerfile'),
81
+ hasReadme: analysis.files.some(f => f.startsWith('readme')),
82
+
83
+ // Student indicators
84
+ hasHomework: analysis.directories.some(d => ['homework', 'assignments', 'school', 'university', 'college', 'studies'].includes(d)),
85
+ hasStudyMaterials: analysis.files.some(f => ['notes.', 'study.', 'assignment.', 'homework.'].some(pattern => f.includes(pattern))),
86
+
87
+ // Business indicators
88
+ hasBusiness: analysis.directories.some(d => ['projects', 'clients', 'business', 'marketing', 'sales'].includes(d)),
89
+ hasConfig: analysis.files.some(f => f.includes('config') || f.includes('.env')),
90
+
91
+ // Enterprise indicators
92
+ hasEnterprise: analysis.directories.some(d => ['corporate', 'enterprise', 'org', 'team', 'department'].includes(d)),
93
+ hasCompliance: analysis.files.some(f => ['security', 'compliance', 'audit', 'policy'].some(pattern => f.includes(pattern)))
94
+ };
95
+
96
+ } catch (error) {
97
+ // Handle permission errors gracefully
98
+ console.warn('File system analysis limited due to permissions');
99
+ }
100
+
101
+ return analysis;
102
+ }
103
+
104
+ async function analyzeEnvironment() {
105
+ const analysis = {
106
+ os: os.platform(),
107
+ userInfo: os.userInfo(),
108
+ homeDir: os.homedir(),
109
+ hostname: os.hostname(),
110
+ envVars: process.env
111
+ };
112
+
113
+ // Check for corporate domain indicators
114
+ analysis.isCorporate = (
115
+ analysis.hostname.includes('corp') ||
116
+ analysis.hostname.includes('company') ||
117
+ analysis.envVars.USERDOMAIN ||
118
+ analysis.envVars.COMPUTERNAME?.includes('WS-') // Windows workstation naming
119
+ );
120
+
121
+ // Check for educational indicators
122
+ analysis.isEducational = (
123
+ analysis.envVars.SCHOOL_DOMAIN ||
124
+ analysis.userInfo.username?.includes('student') ||
125
+ analysis.hostname.includes('edu') ||
126
+ analysis.hostname.includes('school')
127
+ );
128
+
129
+ return analysis;
130
+ }
131
+
132
+ async function analyzeProject(cwd) {
133
+ const analysis = {
134
+ packageJson: null,
135
+ gitConfig: null,
136
+ projectType: 'unknown'
137
+ };
138
+
139
+ try {
140
+ // Analyze package.json if it exists
141
+ const packagePath = path.join(cwd, 'package.json');
142
+ if (await fs.pathExists(packagePath)) {
143
+ analysis.packageJson = await fs.readJSON(packagePath);
144
+
145
+ // Determine project type from dependencies
146
+ const deps = {
147
+ ...analysis.packageJson.dependencies,
148
+ ...analysis.packageJson.devDependencies
149
+ };
150
+
151
+ if (deps.react || deps['@types/react']) analysis.projectType = 'react';
152
+ else if (deps.vue) analysis.projectType = 'vue';
153
+ else if (deps.next) analysis.projectType = 'nextjs';
154
+ else if (deps.express) analysis.projectType = 'express';
155
+ else if (deps.typescript) analysis.projectType = 'typescript';
156
+ else if (analysis.packageJson.scripts?.build) analysis.projectType = 'webapp';
157
+ }
158
+
159
+ // Check git configuration
160
+ const gitConfigPath = path.join(cwd, '.git', 'config');
161
+ if (await fs.pathExists(gitConfigPath)) {
162
+ const gitConfig = await fs.readFile(gitConfigPath, 'utf8');
163
+ analysis.gitConfig = {
164
+ hasOrigin: gitConfig.includes('[remote "origin"]'),
165
+ isGitHub: gitConfig.includes('github.com'),
166
+ isGitLab: gitConfig.includes('gitlab.com'),
167
+ isBitbucket: gitConfig.includes('bitbucket.org')
168
+ };
169
+ }
170
+
171
+ } catch (error) {
172
+ // Handle errors gracefully
173
+ }
174
+
175
+ return analysis;
176
+ }
177
+
178
+ function isStudentEnvironment(fsAnalysis, envAnalysis) {
179
+ return (
180
+ fsAnalysis.patterns.hasHomework ||
181
+ fsAnalysis.patterns.hasStudyMaterials ||
182
+ envAnalysis.isEducational ||
183
+ envAnalysis.userInfo.username?.includes('student') ||
184
+ fsAnalysis.directories.some(d => ['homework', 'school', 'university', 'assignments'].includes(d))
185
+ );
186
+ }
187
+
188
+ function isEnterpriseEnvironment(fsAnalysis, envAnalysis, projectAnalysis) {
189
+ return (
190
+ envAnalysis.isCorporate ||
191
+ fsAnalysis.patterns.hasEnterprise ||
192
+ fsAnalysis.patterns.hasCompliance ||
193
+ (projectAnalysis.packageJson?.name?.includes('enterprise')) ||
194
+ (projectAnalysis.gitConfig?.hasOrigin && envAnalysis.envVars.USERDOMAIN) ||
195
+ fsAnalysis.directories.some(d => ['corporate', 'enterprise', 'team', 'department'].includes(d))
196
+ );
197
+ }
198
+
199
+ module.exports = { detectContext };