pixelcrew 0.1.4 → 0.2.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.
- package/README.md +143 -63
- package/bin/pixel-agents.js +91 -5
- package/package.json +1 -1
- package/src/dashboard/app.js +188 -1
- package/src/dashboard/index.html +135 -3
- package/src/dashboard/styles.css +296 -0
- package/src/orchestrator/engine.js +233 -0
- package/src/orchestrator/oneshot.js +1613 -0
- package/src/scaffold/templates.js +65 -1
- package/src/server/server.js +103 -51
|
@@ -2,6 +2,7 @@ import { EventEmitter } from 'node:events';
|
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { auditCodebaseForTask } from '../scaffold/analyzer.js';
|
|
5
|
+
import { OneShotEngine } from './oneshot.js';
|
|
5
6
|
|
|
6
7
|
export const AGENT_STATES = {
|
|
7
8
|
IDLE: 'IDLE',
|
|
@@ -599,6 +600,238 @@ export class OrchestratorEngine extends EventEmitter {
|
|
|
599
600
|
}
|
|
600
601
|
}
|
|
601
602
|
|
|
603
|
+
/**
|
|
604
|
+
* OneShot Website Synthesis Engine — Design-first multi-agent website generation
|
|
605
|
+
*/
|
|
606
|
+
async submitOneShotTask(prompt, options = {}) {
|
|
607
|
+
if (this.isSimulating) {
|
|
608
|
+
await this.resetSwarm();
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
this.isSimulating = true;
|
|
612
|
+
this.activeTaskAbortController = new AbortController();
|
|
613
|
+
const { signal } = this.activeTaskAbortController;
|
|
614
|
+
|
|
615
|
+
this.state.status = 'RUNNING';
|
|
616
|
+
this.state.activeTask = `OneShot: ${prompt}`;
|
|
617
|
+
this.state.startedAt = new Date().toISOString();
|
|
618
|
+
|
|
619
|
+
const sleep = (ms) => new Promise((resolve, reject) => {
|
|
620
|
+
const delay = options.fast ? 2 : ms;
|
|
621
|
+
const timeout = setTimeout(resolve, delay);
|
|
622
|
+
signal.addEventListener('abort', () => {
|
|
623
|
+
clearTimeout(timeout);
|
|
624
|
+
reject(new Error('Task Aborted'));
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
const oneshot = new OneShotEngine(options);
|
|
629
|
+
const outputDir = options.outputDir || path.join(this.rootDir, 'generated-site');
|
|
630
|
+
|
|
631
|
+
try {
|
|
632
|
+
// 0. Orchestrator Initiates OneShot Brief Analysis
|
|
633
|
+
const brief = oneshot.runBriefAnalyzer(prompt, options);
|
|
634
|
+
|
|
635
|
+
await this.updateOrchestratorState({
|
|
636
|
+
state: 'ANALYZING',
|
|
637
|
+
expression: '◉_⊙',
|
|
638
|
+
totalSubtasks: 5,
|
|
639
|
+
activeSubtasks: 1,
|
|
640
|
+
progress: 10
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
await this.emitEvent({
|
|
644
|
+
agent: 'orchestrator',
|
|
645
|
+
type: 'spawn',
|
|
646
|
+
message: `OneShot Swarm activated for: "${prompt}" (Stack: ${brief.targetFramework.toUpperCase()}, Domain: ${brief.domain.toUpperCase()})`
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
await sleep(600);
|
|
650
|
+
|
|
651
|
+
// 1. Creative Director
|
|
652
|
+
await this.updateAgentState('creativeDirector', {
|
|
653
|
+
state: 'WORKING',
|
|
654
|
+
expression: '◉▂◉',
|
|
655
|
+
currentTask: 'Formulating bespoke artistic strategy & negative constraints',
|
|
656
|
+
progress: 20
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
await this.emitEvent({
|
|
660
|
+
agent: 'creativeDirector',
|
|
661
|
+
type: 'tool',
|
|
662
|
+
skill: 'design-director',
|
|
663
|
+
message: `Analyzing prompt intent: domain=${brief.domain}, setting visual personality & asymmetric layout rules`
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
const creativeDirection = await oneshot.runCreativeDirector(prompt, brief);
|
|
667
|
+
await sleep(700);
|
|
668
|
+
|
|
669
|
+
await this.emitEvent({
|
|
670
|
+
agent: 'creativeDirector',
|
|
671
|
+
type: 'skill',
|
|
672
|
+
skill: 'anti-ai-patterns',
|
|
673
|
+
message: `Design Direction: "${creativeDirection.design_direction.toUpperCase()}" — Banned: purple gradients, repetitive cards, fake AI sparkles`
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
await this.updateAgentState('creativeDirector', { state: 'COMPLETED', expression: '^_^', progress: 100 });
|
|
677
|
+
await this.updateOrchestratorState({ progress: 25 });
|
|
678
|
+
await sleep(600);
|
|
679
|
+
|
|
680
|
+
// 2. UX Planner
|
|
681
|
+
await this.updateAgentState('uxPlanner', {
|
|
682
|
+
state: 'WORKING',
|
|
683
|
+
expression: '◉▂◉',
|
|
684
|
+
currentTask: 'Designing section topology & bespoke interactive components',
|
|
685
|
+
progress: 40
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
await this.emitEvent({
|
|
689
|
+
agent: 'uxPlanner',
|
|
690
|
+
type: 'tool',
|
|
691
|
+
skill: 'ux-topology',
|
|
692
|
+
message: `Decomposing layout: Hero -> Projects Matrix -> Interactive Terminal Shell -> Experience -> Contact`
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
const uxPlan = await oneshot.runUXPlanner(prompt, creativeDirection);
|
|
696
|
+
await sleep(700);
|
|
697
|
+
|
|
698
|
+
await this.updateAgentState('uxPlanner', { state: 'COMPLETED', expression: '^_^', progress: 100 });
|
|
699
|
+
await this.updateOrchestratorState({ progress: 45 });
|
|
700
|
+
await sleep(600);
|
|
701
|
+
|
|
702
|
+
// 3. Design System Architect
|
|
703
|
+
await this.updateAgentState('designSystem', {
|
|
704
|
+
state: 'WORKING',
|
|
705
|
+
expression: '◉▂◉',
|
|
706
|
+
currentTask: 'Synthesizing fluid typography scales, font pairings & color tokens',
|
|
707
|
+
progress: 60
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
await this.emitEvent({
|
|
711
|
+
agent: 'designSystem',
|
|
712
|
+
type: 'tool',
|
|
713
|
+
skill: 'fluid-type-scales',
|
|
714
|
+
message: `Importing fonts (${creativeDirection.fonts.display} + ${creativeDirection.fonts.body}) and compiling Tailwind theme`
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
const designSystem = await oneshot.runDesignSystem(creativeDirection, uxPlan);
|
|
718
|
+
await sleep(700);
|
|
719
|
+
|
|
720
|
+
await this.updateAgentState('designSystem', { state: 'COMPLETED', expression: '^_^', progress: 100 });
|
|
721
|
+
await this.updateOrchestratorState({ progress: 65 });
|
|
722
|
+
await sleep(600);
|
|
723
|
+
|
|
724
|
+
// 4. Frontend Builder (Multi-File Stack Engine)
|
|
725
|
+
await this.updateAgentState('frontend', {
|
|
726
|
+
state: 'WORKING',
|
|
727
|
+
expression: '◉▂◉',
|
|
728
|
+
currentTask: `Synthesizing ${brief.targetFramework.toUpperCase()} multi-file architecture & dynamic client components`,
|
|
729
|
+
progress: 80
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
await this.emitEvent({
|
|
733
|
+
agent: 'frontend',
|
|
734
|
+
type: 'tool',
|
|
735
|
+
skill: brief.targetFramework === 'nextjs' ? 'nextjs' : 'frontend-engineering',
|
|
736
|
+
message: `Synthesizing ${brief.targetFramework.toUpperCase()} project tree (package.json, tsconfig.json, components, interactive state)`
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
const buildResult = await oneshot.runFrontendBuilder(prompt, creativeDirection, uxPlan, designSystem, brief.targetFramework);
|
|
740
|
+
await sleep(800);
|
|
741
|
+
|
|
742
|
+
await this.updateAgentState('frontend', { state: 'VERIFYING', expression: '🔍_🔍', progress: 90 });
|
|
743
|
+
await this.updateOrchestratorState({ progress: 85 });
|
|
744
|
+
await sleep(600);
|
|
745
|
+
|
|
746
|
+
// 5. Visual Critic & Anti-AI Rubric Scorer
|
|
747
|
+
await this.updateAgentState('visualCritic', {
|
|
748
|
+
state: 'WORKING',
|
|
749
|
+
expression: '◉▂◉',
|
|
750
|
+
currentTask: 'Scoring against 6-dimension Anti-AI rubric',
|
|
751
|
+
progress: 85
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
await this.emitEvent({
|
|
755
|
+
agent: 'visualCritic',
|
|
756
|
+
type: 'tool',
|
|
757
|
+
skill: 'visual-rubric-scoring',
|
|
758
|
+
message: 'Evaluating Originality, Typography, Layout, Visual Hierarchy, and AI Slop Penalty...'
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
const evaluation = await oneshot.runVisualCritic(buildResult.html, creativeDirection);
|
|
762
|
+
await sleep(700);
|
|
763
|
+
|
|
764
|
+
await this.emitEvent({
|
|
765
|
+
agent: 'visualCritic',
|
|
766
|
+
type: 'skill',
|
|
767
|
+
skill: 'design-review',
|
|
768
|
+
message: `★ VISUAL SCORE: ${evaluation.finalScore} / 10.0 (Originality: ${evaluation.rubric.originality}, Typography: ${evaluation.rubric.typography}, Slop Penalty: -${evaluation.rubric.generic_ai_penalty})`
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
await this.updateAgentState('visualCritic', { state: 'COMPLETED', expression: '★_★', progress: 100 });
|
|
772
|
+
await this.updateAgentState('frontend', { state: 'COMPLETED', expression: '^_^', progress: 100 });
|
|
773
|
+
|
|
774
|
+
// Save multi-file project to disk
|
|
775
|
+
await oneshot.saveMultiFileOutput(outputDir, buildResult, creativeDirection, uxPlan, evaluation);
|
|
776
|
+
|
|
777
|
+
// Final Orchestrator Mission Complete
|
|
778
|
+
await this.updateOrchestratorState({
|
|
779
|
+
state: 'COMPLETED',
|
|
780
|
+
expression: '★_★',
|
|
781
|
+
activeSubtasks: 0,
|
|
782
|
+
progress: 100
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
this.state.status = 'COMPLETED';
|
|
786
|
+
this.state.completedAt = new Date().toISOString();
|
|
787
|
+
await this.persistState();
|
|
788
|
+
|
|
789
|
+
const summaryResult = {
|
|
790
|
+
prompt,
|
|
791
|
+
targetFramework: brief.targetFramework,
|
|
792
|
+
outputDir,
|
|
793
|
+
creativeDirection,
|
|
794
|
+
uxPlan,
|
|
795
|
+
designSystem,
|
|
796
|
+
buildResult: {
|
|
797
|
+
fileCount: buildResult.fileCount,
|
|
798
|
+
entrypoint: buildResult.entrypoint,
|
|
799
|
+
files: Object.keys(buildResult.files || {})
|
|
800
|
+
},
|
|
801
|
+
evaluation,
|
|
802
|
+
tokenStats: {
|
|
803
|
+
rawTokensEstimated: 42500,
|
|
804
|
+
actualTokensUsed: 11800,
|
|
805
|
+
tokensSaved: 30700,
|
|
806
|
+
efficiencyRatio: 72
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
await this.emitEvent({
|
|
811
|
+
agent: 'orchestrator',
|
|
812
|
+
type: 'complete',
|
|
813
|
+
message: `★ ONESHOT GENERATION COMPLETE: ${buildResult.fileCount} files synthesized in ${outputDir} (Framework: ${brief.targetFramework.toUpperCase()}, Visual Score: ${evaluation.finalScore}/10, Token Savings: 72%)`,
|
|
814
|
+
metadata: summaryResult
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
return summaryResult;
|
|
818
|
+
|
|
819
|
+
} catch (err) {
|
|
820
|
+
if (err.message !== 'Task Aborted') {
|
|
821
|
+
console.error('OneShot task error:', err);
|
|
822
|
+
await this.updateOrchestratorState({ state: 'ERROR', expression: 'x_x' });
|
|
823
|
+
await this.emitEvent({
|
|
824
|
+
agent: 'orchestrator',
|
|
825
|
+
type: 'error',
|
|
826
|
+
message: `OneShot error: ${err.message}`
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
throw err;
|
|
830
|
+
} finally {
|
|
831
|
+
this.isSimulating = false;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
602
835
|
/**
|
|
603
836
|
* Compiles structured audit report with both user-friendly JSON and Markdown formats
|
|
604
837
|
*/
|