oneie 1.0.0 → 1.1.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.
@@ -0,0 +1,406 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Workflow Orchestration Engine
5
+ * Coordinates the complete Mission → Story → Task → Agent cascade
6
+ */
7
+
8
+ import { Command } from 'commander';
9
+ import chalk from 'chalk';
10
+ import { MissionSystem } from './mission-system.js';
11
+ import { StorySystem } from './story-system.js';
12
+ import { TaskSystem } from './task-system.js';
13
+ import { AgentIntegration } from './agent-integration.js';
14
+
15
+ const program = new Command();
16
+
17
+ program
18
+ .name('one:workflow')
19
+ .description('🌊 Workflow orchestration for ONE collaborative intelligence')
20
+ .version('1.0.0');
21
+
22
+ program
23
+ .command('cascade <missionId>')
24
+ .description('Execute complete cascade workflow: Mission → Stories → Tasks → Agents')
25
+ .option('-e, --execute', 'Execute tasks (not just plan)', false)
26
+ .option('-i, --interactive', 'Interactive workflow with human input', false)
27
+ .action(async (missionId, options) => {
28
+ console.log(chalk.cyan.bold('\\n🌊 ONE Cascade Workflow Engine\\n'));
29
+
30
+ try {
31
+ const agentIntegration = new AgentIntegration();
32
+ const result = await agentIntegration.cascadeWorkflow(missionId, {
33
+ execute: options.execute,
34
+ interactive: options.interactive
35
+ });
36
+
37
+ console.log(chalk.green.bold('\\n✅ Cascade workflow completed successfully!'));
38
+ console.log(chalk.blue(`📋 Mission: ${result.mission.name}`));
39
+ console.log(chalk.blue(`📚 Stories: ${result.stories.length}`));
40
+ console.log(chalk.blue(`📋 Total tasks: ${result.totalTasks}`));
41
+ console.log(chalk.blue(`⚡ Completed phases: ${result.completedPhases.join(' → ')}`));
42
+
43
+ } catch (error) {
44
+ console.error(chalk.red('❌ Cascade workflow failed:'), error.message);
45
+ process.exit(1);
46
+ }
47
+ });
48
+
49
+ program
50
+ .command('execute-task <taskId>')
51
+ .description('Execute a specific task using agent integration')
52
+ .option('-s, --simulate', 'Simulate execution without real work', true)
53
+ .action(async (taskId, options) => {
54
+ console.log(chalk.cyan.bold('\\n🤖 Task Execution Engine\\n'));
55
+
56
+ try {
57
+ const agentIntegration = new AgentIntegration();
58
+ const result = await agentIntegration.executeTask(taskId, {
59
+ simulate: options.simulate
60
+ });
61
+
62
+ if (result.success) {
63
+ console.log(chalk.green.bold('\\n✅ Task execution completed!'));
64
+ console.log(chalk.blue(`📋 Execution phases: ${result.executionPlan.phases.length}`));
65
+ console.log(chalk.blue(`⏱️ Total time: ${result.executionPlan.totalEstimatedTime}`));
66
+ } else {
67
+ console.log(chalk.red.bold('\\n❌ Task execution failed!'));
68
+ console.log(chalk.red(`Error: ${result.error}`));
69
+ process.exit(1);
70
+ }
71
+
72
+ } catch (error) {
73
+ console.error(chalk.red('❌ Task execution failed:'), error.message);
74
+ process.exit(1);
75
+ }
76
+ });
77
+
78
+ program
79
+ .command('workload')
80
+ .description('Show agent workload across all active tasks')
81
+ .action(async () => {
82
+ console.log(chalk.cyan.bold('\\n🤖 Agent Workload Analysis\\n'));
83
+
84
+ try {
85
+ const agentIntegration = new AgentIntegration();
86
+ const workload = await agentIntegration.getAgentWorkload();
87
+
88
+ if (Object.keys(workload).length === 0) {
89
+ console.log(chalk.yellow('📊 No active tasks found'));
90
+ console.log(chalk.gray('All agents are available for new assignments'));
91
+ return;
92
+ }
93
+
94
+ console.log(chalk.blue('📊 Active Agent Workload\\n'));
95
+
96
+ // Sort agents by workload (descending)
97
+ const sortedAgents = Object.entries(workload)
98
+ .sort(([,a], [,b]) => b.activeTasks - a.activeTasks);
99
+
100
+ sortedAgents.forEach(([agent, data]) => {
101
+ const loadColor = data.activeTasks > 3 ? 'red' : data.activeTasks > 1 ? 'yellow' : 'green';
102
+
103
+ console.log(chalk[loadColor](`🤖 ${agent}: ${data.activeTasks} active tasks`));
104
+
105
+ data.tasks.forEach(task => {
106
+ const priorityEmoji = {
107
+ 'high': '🔥',
108
+ 'medium': '⚡',
109
+ 'low': '💡'
110
+ }[task.priority] || '📋';
111
+
112
+ console.log(chalk.gray(` ${priorityEmoji} ${task.name} (${task.id})`));
113
+ });
114
+
115
+ console.log('');
116
+ });
117
+
118
+ // Show available agents
119
+ const allAgents = [
120
+ 'Mission Commander', 'Story Teller', 'Task Master',
121
+ 'Engineering Director', 'Engineering Architect', 'Engineering Developer',
122
+ 'Engineering Quality Assurance', 'Engineering User Experience',
123
+ 'Marketing Director', 'Marketing Viral Growth', 'Marketing Brand Identity',
124
+ 'Content Team Manager', 'Research Team Manager', 'Service Team Manager'
125
+ ];
126
+
127
+ const availableAgents = allAgents.filter(agent => !workload[agent]);
128
+
129
+ if (availableAgents.length > 0) {
130
+ console.log(chalk.green('✅ Available Agents\\n'));
131
+ availableAgents.forEach(agent => {
132
+ console.log(chalk.green(`🤖 ${agent} (0 active tasks)`));
133
+ });
134
+ }
135
+
136
+ } catch (error) {
137
+ console.error(chalk.red('❌ Failed to get workload analysis:'), error.message);
138
+ process.exit(1);
139
+ }
140
+ });
141
+
142
+ program
143
+ .command('status <missionId>')
144
+ .description('Show complete workflow status for a mission')
145
+ .action(async (missionId) => {
146
+ console.log(chalk.cyan.bold(`\\n📊 Workflow Status: Mission ${missionId}\\n`));
147
+
148
+ try {
149
+ // Get mission details
150
+ const missionSystem = new MissionSystem();
151
+ const mission = await missionSystem.getMission(missionId);
152
+
153
+ if (!mission) {
154
+ console.log(chalk.red(`❌ Mission not found: ${missionId}`));
155
+ return;
156
+ }
157
+
158
+ // Get stories
159
+ const storySystem = new StorySystem();
160
+ const stories = await storySystem.listStories(missionId);
161
+
162
+ // Get all tasks for this mission
163
+ const taskSystem = new TaskSystem();
164
+ const allTasks = await taskSystem.listTasks();
165
+ const missionTasks = allTasks.filter(task => task.missionId === missionId);
166
+
167
+ // Show mission overview
168
+ console.log(chalk.blue('🎯 Mission Overview'));
169
+ console.log(` Name: ${mission.name}`);
170
+ console.log(` Status: ${mission.status}`);
171
+ console.log(` Complexity: ${mission.complexity}`);
172
+ console.log(` Created: ${new Date(mission.created).toLocaleDateString()}`);
173
+
174
+ // Show cascade progress
175
+ console.log(chalk.blue('\\n🌊 Cascade Progress'));
176
+
177
+ const missionPhase = mission.status === 'completed' ? '✅' : mission.status === 'active' ? '🚀' : '📋';
178
+ console.log(` ${missionPhase} Mission Commander: ${mission.status}`);
179
+
180
+ const storiesActive = stories.filter(s => s.status === 'active').length;
181
+ const storiesCompleted = stories.filter(s => s.status === 'completed').length;
182
+ const storyPhase = storiesCompleted > 0 ? '✅' : storiesActive > 0 ? '🚀' : stories.length > 0 ? '📋' : '⏳';
183
+ console.log(` ${storyPhase} Story Teller: ${stories.length} stories (${storiesActive} active, ${storiesCompleted} completed)`);
184
+
185
+ const tasksActive = missionTasks.filter(t => t.status === 'active').length;
186
+ const tasksCompleted = missionTasks.filter(t => t.status === 'completed').length;
187
+ const taskPhase = tasksCompleted > 0 ? '✅' : tasksActive > 0 ? '🚀' : missionTasks.length > 0 ? '📋' : '⏳';
188
+ console.log(` ${taskPhase} Task Master: ${missionTasks.length} tasks (${tasksActive} active, ${tasksCompleted} completed)`);
189
+
190
+ // Show detailed breakdown
191
+ if (stories.length > 0) {
192
+ console.log(chalk.blue('\\n📚 Story Breakdown'));
193
+
194
+ stories.forEach(story => {
195
+ const statusEmoji = {
196
+ 'planning': '📋',
197
+ 'active': '🚀',
198
+ 'completed': '✅',
199
+ 'paused': '⏸️'
200
+ }[story.status] || '📋';
201
+
202
+ console.log(` ${statusEmoji} ${story.name} (${story.status})`);
203
+ console.log(chalk.gray(` ${story.agents?.length || 0} agents • ${story.tasks?.length || 0} tasks • ${story.priority} priority`));
204
+ });
205
+ }
206
+
207
+ if (missionTasks.length > 0) {
208
+ console.log(chalk.blue('\\n📋 Task Summary'));
209
+
210
+ const tasksByStatus = missionTasks.reduce((acc, task) => {
211
+ acc[task.status] = (acc[task.status] || 0) + 1;
212
+ return acc;
213
+ }, {});
214
+
215
+ Object.entries(tasksByStatus).forEach(([status, count]) => {
216
+ const color = {
217
+ 'pending': 'yellow',
218
+ 'active': 'green',
219
+ 'completed': 'blue',
220
+ 'blocked': 'red'
221
+ }[status] || 'white';
222
+
223
+ console.log(chalk[color](` ${status}: ${count} tasks`));
224
+ });
225
+
226
+ // Show active tasks
227
+ const activeTasks = missionTasks.filter(t => t.status === 'active');
228
+ if (activeTasks.length > 0) {
229
+ console.log(chalk.blue('\\n🚀 Currently Active Tasks'));
230
+ activeTasks.forEach(task => {
231
+ const priorityEmoji = {
232
+ 'high': '🔥',
233
+ 'medium': '⚡',
234
+ 'low': '💡'
235
+ }[task.priority] || '📋';
236
+
237
+ console.log(` ${priorityEmoji} ${task.name}`);
238
+ console.log(chalk.gray(` Agents: ${task.agents.join(', ')}`));
239
+ console.log(chalk.gray(` Duration: ${task.duration} • Priority: ${task.priority}`));
240
+ });
241
+ }
242
+ }
243
+
244
+ // Show next actions
245
+ console.log(chalk.blue('\\n🚀 Next Actions'));
246
+
247
+ if (mission.status === 'planning') {
248
+ console.log(' 1. Start mission: one:mission start ' + missionId);
249
+ if (stories.length === 0) {
250
+ console.log(' 2. Create stories: one:story create ' + missionId + ' "Story objective"');
251
+ }
252
+ }
253
+
254
+ const pendingStories = stories.filter(s => s.status === 'planning');
255
+ if (pendingStories.length > 0) {
256
+ console.log(` • Start ${pendingStories.length} pending stories`);
257
+ }
258
+
259
+ const pendingTasks = missionTasks.filter(t => t.status === 'pending');
260
+ if (pendingTasks.length > 0) {
261
+ console.log(` • Execute ${pendingTasks.length} pending tasks: one:workflow execute-task <task-id>`);
262
+ }
263
+
264
+ const activeTasks = missionTasks.filter(t => t.status === 'active');
265
+ if (pendingTasks.length === 0 && activeTasks.length === 0 && stories.length > 0) {
266
+ console.log(' • Mission appears ready for completion review');
267
+ }
268
+
269
+ } catch (error) {
270
+ console.error(chalk.red('❌ Failed to get workflow status:'), error.message);
271
+ process.exit(1);
272
+ }
273
+ });
274
+
275
+ program
276
+ .command('create-complete <objective>')
277
+ .description('Create complete mission with stories and tasks in one command')
278
+ .option('-a, --auto', 'Fully automated creation', false)
279
+ .action(async (objective, options) => {
280
+ console.log(chalk.cyan.bold('\\n🚀 Complete Mission Creation\\n'));
281
+
282
+ try {
283
+ // Phase 1: Create mission
284
+ console.log(chalk.yellow('👑 Phase 1: Mission Commander - Creating mission...'));
285
+ const missionSystem = new MissionSystem();
286
+ const mission = await missionSystem.createMission(objective, {
287
+ interactive: !options.auto
288
+ });
289
+
290
+ console.log(chalk.green(`✅ Mission created: ${mission.id}`));
291
+
292
+ // Phase 2: Create stories from mission
293
+ console.log(chalk.green('\\n📚 Phase 2: Story Teller - Creating stories...'));
294
+ const storySystem = new StorySystem();
295
+
296
+ const storyObjectives = [
297
+ `Plan and design ${objective}`,
298
+ `Implement ${objective}`,
299
+ `Test and validate ${objective}`,
300
+ `Deploy and launch ${objective}`
301
+ ];
302
+
303
+ const createdStories = [];
304
+ for (const storyObjective of storyObjectives) {
305
+ console.log(chalk.cyan(` 📖 Creating story: ${storyObjective}`));
306
+ const story = await storySystem.createStory(mission.id, storyObjective, {
307
+ interactive: false
308
+ });
309
+ createdStories.push(story);
310
+ console.log(chalk.green(` ✅ Story created: ${story.id}`));
311
+ }
312
+
313
+ // Phase 3: Create tasks for each story
314
+ console.log(chalk.blue('\\n⚡ Phase 3: Task Master - Creating tasks...'));
315
+ const taskSystem = new TaskSystem();
316
+
317
+ let totalTasks = 0;
318
+ for (const story of createdStories) {
319
+ console.log(chalk.cyan(` 📖 Processing story: ${story.name}`));
320
+
321
+ // Create 2-3 tasks per story based on story type
322
+ const taskNames = this.generateTasksForStory(story);
323
+
324
+ for (const taskName of taskNames) {
325
+ console.log(chalk.yellow(` 📋 Creating task: ${taskName}`));
326
+ const task = await taskSystem.createTask(story.id, taskName, {
327
+ interactive: false
328
+ });
329
+ console.log(chalk.green(` ✅ Task created: ${task.id}`));
330
+ totalTasks++;
331
+ }
332
+ }
333
+
334
+ console.log(chalk.green.bold('\\n🎉 Complete mission creation finished!'));
335
+ console.log(chalk.blue(`📋 Mission: ${mission.name} (${mission.id})`));
336
+ console.log(chalk.blue(`📚 Stories: ${createdStories.length} created`));
337
+ console.log(chalk.blue(`📋 Tasks: ${totalTasks} created`));
338
+
339
+ console.log(chalk.yellow('\\n🚀 Next steps:'));
340
+ console.log(' 1. Review complete workflow: one:workflow status ' + mission.id);
341
+ console.log(' 2. Execute cascade workflow: one:workflow cascade ' + mission.id);
342
+ console.log(' 3. Start individual tasks: one:task start <task-id>');
343
+
344
+ } catch (error) {
345
+ console.error(chalk.red('❌ Complete mission creation failed:'), error.message);
346
+ process.exit(1);
347
+ }
348
+ });
349
+
350
+ // Helper function to generate tasks for stories
351
+ function generateTasksForStory(story) {
352
+ const storyName = story.name.toLowerCase();
353
+
354
+ if (storyName.includes('plan') || storyName.includes('design')) {
355
+ return [
356
+ 'Analyze requirements and constraints',
357
+ 'Create architectural design',
358
+ 'Document specifications'
359
+ ];
360
+ } else if (storyName.includes('implement')) {
361
+ return [
362
+ 'Set up development environment',
363
+ 'Implement core functionality',
364
+ 'Create user interfaces',
365
+ 'Integrate with existing systems'
366
+ ];
367
+ } else if (storyName.includes('test')) {
368
+ return [
369
+ 'Design test strategy',
370
+ 'Create automated tests',
371
+ 'Execute testing phases',
372
+ 'Document results'
373
+ ];
374
+ } else if (storyName.includes('deploy') || storyName.includes('launch')) {
375
+ return [
376
+ 'Prepare deployment environment',
377
+ 'Execute deployment process',
378
+ 'Monitor system performance',
379
+ 'Create launch documentation'
380
+ ];
381
+ } else {
382
+ return [
383
+ 'Plan approach and timeline',
384
+ 'Execute main deliverables',
385
+ 'Validate and review results'
386
+ ];
387
+ }
388
+ }
389
+
390
+ // Handle no command
391
+ program.action(() => {
392
+ console.log(chalk.cyan.bold('\\n🌊 ONE Workflow Orchestration\\n'));
393
+ console.log('Available commands:');
394
+ console.log(' cascade <mission> Execute complete cascade workflow');
395
+ console.log(' execute-task <task> Execute specific task');
396
+ console.log(' workload Show agent workload');
397
+ console.log(' status <mission> Show workflow status');
398
+ console.log(' create-complete <objective> Create complete mission workflow');
399
+ console.log('');
400
+ console.log(chalk.gray('Example: one:workflow cascade mission-123'));
401
+ console.log(chalk.gray('Example: one:workflow create-complete "Build user authentication"'));
402
+ });
403
+
404
+ program.parse();
405
+
406
+ export { program };
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "oneie",
3
- "version": "1.0.0",
4
- "description": "🤝 Universal Collaborative Intelligence - Transform any project into a space where humans and AI agents work as equals. From kids' homework to enterprise systems, ONE adapts to your context and enables true collaborative intelligence through `npx oneie`.",
3
+ "version": "1.1.0",
4
+ "description": "🤝 Universal Collaborative Intelligence - Complete Mission → Story → Task → Agent workflow system. Transform any project into a space where humans and AI agents work as equals. From kids' homework to enterprise systems, ONE adapts to your context and enables true collaborative intelligence through `npx oneie`.",
5
5
  "type": "module",
6
6
  "main": "one/tools/one-cli.js",
7
7
  "bin": {
8
8
  "oneie": "bin/collaborative-install.js",
9
9
  "one:agent": "one/tools/bin/one-agent.js",
10
- "one:mission": "one/tools/bin/one-mission.js",
11
- "one:story": "one/tools/bin/one-story.js",
10
+ "one:mission": "bin/one-mission.js",
11
+ "one:story": "bin/one-story.js",
12
+ "one:task": "bin/one-task.js",
13
+ "one:workflow": "bin/workflow-orchestration.js",
12
14
  "one:team": "one/tools/bin/one-team.js",
13
15
  "one:playbook": "one/tools/bin/one-playbook.js",
14
16
  "one:tools": "one/tools/bin/one-tools.js"
@@ -111,6 +113,10 @@
111
113
  "keywords": [
112
114
  "collaborative-intelligence",
113
115
  "human-ai-partnership",
116
+ "mission-workflow",
117
+ "story-driven-development",
118
+ "task-orchestration",
119
+ "agent-integration",
114
120
  "universal-installer",
115
121
  "equal-participation",
116
122
  "mission-driven",
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Direct mission access: npx one:mission
4
- */
5
-
6
- import { exec } from 'child_process';
7
- import { promisify } from 'util';
8
-
9
- const execAsync = promisify(exec);
10
-
11
- async function main() {
12
- try {
13
- const args = process.argv.slice(2);
14
- const command = `node one/tools/cli.js one:mission ${args.join(' ')}`;
15
- const { stdout, stderr } = await execAsync(command);
16
-
17
- if (stdout) console.log(stdout);
18
- if (stderr) console.error(stderr);
19
- } catch (error) {
20
- console.error('Error:', error.message);
21
- process.exit(1);
22
- }
23
- }
24
-
25
- main();
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Direct story access: npx one:story
4
- */
5
-
6
- import { exec } from 'child_process';
7
- import { promisify } from 'util';
8
-
9
- const execAsync = promisify(exec);
10
-
11
- async function main() {
12
- try {
13
- const args = process.argv.slice(2);
14
- const command = `node one/tools/cli.js one:story ${args.join(' ')}`;
15
- const { stdout, stderr } = await execAsync(command);
16
-
17
- if (stdout) console.log(stdout);
18
- if (stderr) console.error(stderr);
19
- } catch (error) {
20
- console.error('Error:', error.message);
21
- process.exit(1);
22
- }
23
- }
24
-
25
- main();