@vishal_20/basetree 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.
- package/.env.example +10 -0
- package/README.md +369 -0
- package/dist/agents/alignmentAgent.js +68 -0
- package/dist/agents/governanceOrchestrator.js +152 -0
- package/dist/agents/planet/climateAgent.js +39 -0
- package/dist/agents/planet/diplomacyAgent.js +52 -0
- package/dist/agents/planet/discoveryAgent.js +41 -0
- package/dist/agents/planet/economicAgent.js +64 -0
- package/dist/agents/planet/educationAgent.js +41 -0
- package/dist/agents/planet/governanceCouncilAgent.js +76 -0
- package/dist/agents/planet/healthcareAgent.js +42 -0
- package/dist/agents/planet/infrastructureAgent.js +49 -0
- package/dist/agents/planet/planetAgent.js +5 -0
- package/dist/agents/planet/riskStabilityAgent.js +84 -0
- package/dist/agents/planet/urbanSystemsAgent.js +42 -0
- package/dist/agents/policyAgent.js +31 -0
- package/dist/agents/promptGenomeAgent.js +120 -0
- package/dist/agents/reasoningOptimizerAgent.js +72 -0
- package/dist/agents/regressionAgent.js +162 -0
- package/dist/agents/reinforcementLearnerAgent.js +108 -0
- package/dist/agents/riskEvaluationAgent.js +131 -0
- package/dist/agents/rollbackAgent.js +53 -0
- package/dist/agents/stabilityAgent.js +90 -0
- package/dist/agents/strategyMutationAgent.js +74 -0
- package/dist/agents/systemIntrospectionAgent.js +274 -0
- package/dist/agents/upgradeExecutorAgent.js +146 -0
- package/dist/agents/upgradePlannerAgent.js +80 -0
- package/dist/agents/venture/businessModelAgent.js +81 -0
- package/dist/agents/venture/growthAgent.js +82 -0
- package/dist/agents/venture/ideationAgent.js +89 -0
- package/dist/agents/venture/investorAgent.js +90 -0
- package/dist/agents/venture/legalAgent.js +112 -0
- package/dist/agents/venture/marketResearchAgent.js +80 -0
- package/dist/agents/venture/productAgent.js +96 -0
- package/dist/agents/venture/revenueAgent.js +63 -0
- package/dist/agents/venture/validationAgent.js +189 -0
- package/dist/bootstrap.js +200 -0
- package/dist/cli.js +453 -0
- package/dist/cognitiveGraph/cognitiveGraphEngine.js +180 -0
- package/dist/cognitiveGraph/graphStore.js +81 -0
- package/dist/cognitiveGraph/reasoningStreamBus.js +190 -0
- package/dist/config/config.js +76 -0
- package/dist/core/agent/AdaptivePlanner.js +49 -0
- package/dist/core/agent/AutoFixEngine.js +37 -0
- package/dist/core/agent/ExecutorAgent.js +79 -0
- package/dist/core/agent/LearningMemoryAgent.js +67 -0
- package/dist/core/agent/MemoryAgent.js +35 -0
- package/dist/core/agent/MetaCognitionAgent.js +38 -0
- package/dist/core/agent/PlannerAgent.js +59 -0
- package/dist/core/agent/ReflectionLoop.js +34 -0
- package/dist/core/agent/ReviewerAgent.js +34 -0
- package/dist/core/agent/VerificationAgent.js +20 -0
- package/dist/core/agent/specialists/SpecializedAgents.js +43 -0
- package/dist/core/ai/GeminiProvider.js +113 -0
- package/dist/core/ai/listModels.js +73 -0
- package/dist/core/monitor/PerformanceMonitor.js +18 -0
- package/dist/core/swarm/AgentSwarm.js +56 -0
- package/dist/core/swarm/ReasoningBus.js +26 -0
- package/dist/core/swarm/SwarmOrchestrator.js +36 -0
- package/dist/discovery/experimentOrchestrator.js +75 -0
- package/dist/discovery/hypothesisEngine.js +79 -0
- package/dist/discovery/knowledgeSynthesizer.js +83 -0
- package/dist/discovery/simulationPipeline.js +57 -0
- package/dist/experiments/experimentationEngine.js +174 -0
- package/dist/index.js +67 -0
- package/dist/kernel/eventBus.js +89 -0
- package/dist/kernel/kernel.js +146 -0
- package/dist/llm/tokenEfficiencyOptimizer.js +91 -0
- package/dist/memory/civilizationMemory.js +147 -0
- package/dist/memory/globalVectorMemory.js +87 -0
- package/dist/mesh/crossOrgProtocol.js +110 -0
- package/dist/mesh/globalReasoningBus.js +99 -0
- package/dist/observability/businessDashboard.js +103 -0
- package/dist/observability/businessMetrics.js +105 -0
- package/dist/observability/cognitiveMetrics.js +119 -0
- package/dist/observability/failureSurfaceMapper.js +135 -0
- package/dist/observability/metricsCollector.js +94 -0
- package/dist/observability/planetaryDashboard.js +97 -0
- package/dist/observability/planetaryMetrics.js +127 -0
- package/dist/observability/reportRenderer.js +100 -0
- package/dist/performance/memoryProfiler.js +107 -0
- package/dist/performance/profiler.js +130 -0
- package/dist/pipelines/evolvePipeline.js +150 -0
- package/dist/pipelines/governanceReviewPipeline.js +68 -0
- package/dist/pipelines/introspectPipeline.js +73 -0
- package/dist/pipelines/venture/growPipeline.js +51 -0
- package/dist/pipelines/venture/launchPipeline.js +55 -0
- package/dist/pipelines/venture/monetizePipeline.js +46 -0
- package/dist/pipelines/venture/shutdownPipeline.js +40 -0
- package/dist/pipelines/venture/startupPipeline.js +145 -0
- package/dist/pipelines/venture/validatePipeline.js +40 -0
- package/dist/planet/controlPlane.js +131 -0
- package/dist/planet/executionEngine.js +142 -0
- package/dist/planet/globalTypes.js +5 -0
- package/dist/planet/regionManager.js +114 -0
- package/dist/quality/codeQualityAuditor.js +161 -0
- package/dist/safety/containmentProtocols.js +87 -0
- package/dist/safety/integrityChecker.js +110 -0
- package/dist/safety/kernelGuard.js +57 -0
- package/dist/safety/killSwitch.js +100 -0
- package/dist/safety/planetaryKernel.js +92 -0
- package/dist/safety/policyEngine.js +129 -0
- package/dist/safety/rollbackManager.js +141 -0
- package/dist/safety/sandbox.js +143 -0
- package/dist/server/mindmapServer.js +102 -0
- package/dist/state/distributedState.js +241 -0
- package/dist/state/fileStateStore.js +264 -0
- package/dist/state/snapshotter.js +96 -0
- package/dist/state/stateStore.js +5 -0
- package/dist/tools/FileTools.js +25 -0
- package/dist/tools/GitTools.js +16 -0
- package/dist/tools/ShellTools.js +24 -0
- package/dist/types/architecture.js +5 -0
- package/dist/types/core.js +35 -0
- package/dist/types/governance.js +5 -0
- package/dist/types/venture.js +5 -0
- package/dist/ui/App.js +32 -0
- package/dist/ui/animation/AnimationEngine.js +117 -0
- package/dist/ui/animation/Easing.js +61 -0
- package/dist/ui/cli.js +50 -0
- package/dist/ui/command/ActionPreview.js +47 -0
- package/dist/ui/command/CommandPalette.js +55 -0
- package/dist/ui/command/NaturalLanguageBar.js +77 -0
- package/dist/ui/emotion/AnimationSequences.js +59 -0
- package/dist/ui/emotion/EmotionalUXEngine.js +86 -0
- package/dist/ui/integration/BackendAdapter.js +50 -0
- package/dist/ui/integration/WebSocketAdapter.js +90 -0
- package/dist/ui/intelligence/AdaptiveUIEngine.js +75 -0
- package/dist/ui/intelligence/UserBehaviorTracker.js +88 -0
- package/dist/ui/layout/LayoutEngine.js +115 -0
- package/dist/ui/mindmap/CognitiveMindmapRenderer.js +53 -0
- package/dist/ui/mindmap/EdgeRenderer.js +35 -0
- package/dist/ui/mindmap/GraphLayout.js +137 -0
- package/dist/ui/mindmap/MindmapControls.js +53 -0
- package/dist/ui/mindmap/NodeRenderer.js +53 -0
- package/dist/ui/modes/CognitiveMode.js +31 -0
- package/dist/ui/modes/CommandMode.js +6 -0
- package/dist/ui/modes/GovernanceMode.js +6 -0
- package/dist/ui/modes/MissionControlMode.js +6 -0
- package/dist/ui/modes/ModeManager.js +67 -0
- package/dist/ui/modes/ObservatoryMode.js +10 -0
- package/dist/ui/modes/TimelineMode.js +27 -0
- package/dist/ui/terminalOS.js +180 -0
- package/dist/ui/theme/ThemeEngine.js +164 -0
- package/dist/ui/visual/ColorGradient.js +91 -0
- package/dist/ui/visual/Typography.js +128 -0
- package/dist/ui/visual/UnicodeRenderer.js +86 -0
- package/dist/venture/ventureMemory.js +62 -0
- package/package.json +70 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launch Pipeline for BASETREE V6
|
|
3
|
+
* Orchestrates MVP deployment
|
|
4
|
+
*/
|
|
5
|
+
import { getKernel } from '../../kernel/kernel.js';
|
|
6
|
+
import { FileTools } from '../../tools/FileTools.js';
|
|
7
|
+
import { execa } from 'execa';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import ora from 'ora';
|
|
11
|
+
export class LaunchPipeline {
|
|
12
|
+
kernel = getKernel();
|
|
13
|
+
async run(ventureId) {
|
|
14
|
+
const spinner = ora(`Launching venture ${ventureId}...`).start();
|
|
15
|
+
try {
|
|
16
|
+
const venture = await this.kernel.getStateStore().getVenture(ventureId);
|
|
17
|
+
if (!venture) {
|
|
18
|
+
throw new Error(`Venture ${ventureId} not found`);
|
|
19
|
+
}
|
|
20
|
+
const venturePath = join('ventures', venture.slug);
|
|
21
|
+
// Build project
|
|
22
|
+
spinner.text = 'Building project...';
|
|
23
|
+
try {
|
|
24
|
+
await execa('npm', ['install'], {
|
|
25
|
+
cwd: venturePath,
|
|
26
|
+
reject: false,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.warn(chalk.yellow('Build warnings:'), error.message);
|
|
31
|
+
}
|
|
32
|
+
// Create launch script
|
|
33
|
+
spinner.text = 'Setting up launch configuration...';
|
|
34
|
+
await FileTools.writeFile(join(venturePath, 'launch.json'), JSON.stringify({
|
|
35
|
+
ventureId: venture.id,
|
|
36
|
+
launchedAt: new Date().toISOString(),
|
|
37
|
+
status: 'launched',
|
|
38
|
+
}, null, 2));
|
|
39
|
+
// Update venture stage
|
|
40
|
+
await this.kernel.getStateStore().updateVenture(ventureId, {
|
|
41
|
+
stage: 'launched',
|
|
42
|
+
});
|
|
43
|
+
spinner.succeed('Venture launched successfully!');
|
|
44
|
+
console.log(chalk.green(`\nVenture "${venture.idea}" is now live!`));
|
|
45
|
+
console.log(chalk.blue(`\nLocation: ${venturePath}`));
|
|
46
|
+
console.log(chalk.blue(`\nNext steps:`));
|
|
47
|
+
console.log(chalk.blue(`1. Run: basetree grow ${ventureId}`));
|
|
48
|
+
console.log(chalk.blue(`2. Monitor metrics: basetree metrics --venture ${ventureId}`));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
spinner.fail(`Launch failed: ${error.message}`);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monetize Pipeline for BASETREE V6
|
|
3
|
+
* Orchestrates revenue optimization
|
|
4
|
+
*/
|
|
5
|
+
import { getKernel } from '../../kernel/kernel.js';
|
|
6
|
+
import { RevenueAgent } from '../../agents/venture/revenueAgent.js';
|
|
7
|
+
import { ExperimentationEngine } from '../../experiments/experimentationEngine.js';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import ora from 'ora';
|
|
10
|
+
export class MonetizePipeline {
|
|
11
|
+
kernel = getKernel();
|
|
12
|
+
revenueAgent = new RevenueAgent();
|
|
13
|
+
experimentationEngine = new ExperimentationEngine();
|
|
14
|
+
async run(ventureId) {
|
|
15
|
+
const spinner = ora(`Monetizing venture ${ventureId}...`).start();
|
|
16
|
+
try {
|
|
17
|
+
const venture = await this.kernel.getStateStore().getVenture(ventureId);
|
|
18
|
+
if (!venture) {
|
|
19
|
+
throw new Error(`Venture ${ventureId} not found`);
|
|
20
|
+
}
|
|
21
|
+
if (!venture.businessModel) {
|
|
22
|
+
throw new Error('Business model not defined. Run startup pipeline first.');
|
|
23
|
+
}
|
|
24
|
+
// Create pricing experiment
|
|
25
|
+
spinner.text = 'Creating pricing experiment...';
|
|
26
|
+
const pricingExperiment = await this.revenueAgent.createRevenueExperiment(ventureId, venture.businessModel.pricePoints);
|
|
27
|
+
spinner.succeed('Pricing experiment created');
|
|
28
|
+
// Update venture stage
|
|
29
|
+
await this.kernel.getStateStore().updateVenture(ventureId, {
|
|
30
|
+
stage: 'monetizing',
|
|
31
|
+
experimentIds: [...venture.experimentIds, pricingExperiment.id],
|
|
32
|
+
});
|
|
33
|
+
spinner.succeed('Monetization pipeline initiated!');
|
|
34
|
+
console.log(chalk.green(`\nPricing experiment for "${venture.idea}"`));
|
|
35
|
+
console.log(chalk.blue(`\nTesting price points: $${venture.businessModel.pricePoints.join(', $')}`));
|
|
36
|
+
console.log(chalk.blue(`Experiment ID: ${pricingExperiment.id}`));
|
|
37
|
+
console.log(chalk.blue(`\nNext steps:`));
|
|
38
|
+
console.log(chalk.blue(`1. Track conversion metrics`));
|
|
39
|
+
console.log(chalk.blue(`2. Analyze results: basetree metrics --venture ${ventureId}`));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
spinner.fail(`Monetization pipeline failed: ${error.message}`);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shutdown Pipeline for BASETREE V6
|
|
3
|
+
* Orchestrates graceful shutdown and learning
|
|
4
|
+
*/
|
|
5
|
+
import { getKernel } from '../../kernel/kernel.js';
|
|
6
|
+
import { VentureMemory } from '../../venture/ventureMemory.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import ora from 'ora';
|
|
9
|
+
export class ShutdownPipeline {
|
|
10
|
+
kernel = getKernel();
|
|
11
|
+
memory = new VentureMemory();
|
|
12
|
+
async run(ventureId, reason) {
|
|
13
|
+
const spinner = ora(`Shutting down venture ${ventureId}...`).start();
|
|
14
|
+
try {
|
|
15
|
+
const venture = await this.kernel.getStateStore().getVenture(ventureId);
|
|
16
|
+
if (!venture) {
|
|
17
|
+
throw new Error(`Venture ${ventureId} not found`);
|
|
18
|
+
}
|
|
19
|
+
// Record failure lesson
|
|
20
|
+
spinner.text = 'Recording lessons learned...';
|
|
21
|
+
await this.memory.recordFailureLesson(ventureId, `Shutdown: ${venture.idea}`, `Reason: ${reason}\nStage: ${venture.stage}\nMetrics: MRR $${venture.metrics.mrr}, CAC $${venture.metrics.cac}, LTV $${venture.metrics.ltv}`, ['shutdown', venture.stage, 'failure']);
|
|
22
|
+
// Extract learnings
|
|
23
|
+
if (venture.metrics.mrr > 0) {
|
|
24
|
+
await this.memory.recordTractionModel(ventureId, `Traction model: ${venture.idea}`, `Achieved MRR of $${venture.metrics.mrr} with CAC $${venture.metrics.cac}`, ['traction', 'success']);
|
|
25
|
+
}
|
|
26
|
+
// Update venture stage
|
|
27
|
+
await this.kernel.getStateStore().updateVenture(ventureId, {
|
|
28
|
+
stage: 'shutdown',
|
|
29
|
+
});
|
|
30
|
+
spinner.succeed('Venture shutdown completed');
|
|
31
|
+
console.log(chalk.yellow(`\nVenture "${venture.idea}" has been shut down`));
|
|
32
|
+
console.log(chalk.blue(`Reason: ${reason}`));
|
|
33
|
+
console.log(chalk.blue(`Lessons learned have been recorded for future ventures`));
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
spinner.fail(`Shutdown failed: ${error.message}`);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup Pipeline for BASETREE V6
|
|
3
|
+
* Orchestrates: Idea generation → Market research → Validation → MVP build
|
|
4
|
+
*/
|
|
5
|
+
import { IdeationAgent } from '../../agents/venture/ideationAgent.js';
|
|
6
|
+
import { MarketResearchAgent } from '../../agents/venture/marketResearchAgent.js';
|
|
7
|
+
import { ValidationAgent } from '../../agents/venture/validationAgent.js';
|
|
8
|
+
import { BusinessModelAgent } from '../../agents/venture/businessModelAgent.js';
|
|
9
|
+
import { ProductAgent } from '../../agents/venture/productAgent.js';
|
|
10
|
+
import { GeminiProvider } from '../../core/ai/GeminiProvider.js';
|
|
11
|
+
import { LearningMemoryAgent } from '../../core/agent/LearningMemoryAgent.js';
|
|
12
|
+
import { getKernel } from '../../kernel/kernel.js';
|
|
13
|
+
import { FileTools } from '../../tools/FileTools.js';
|
|
14
|
+
import { randomUUID } from 'crypto';
|
|
15
|
+
import { join } from 'path';
|
|
16
|
+
import chalk from 'chalk';
|
|
17
|
+
import ora from 'ora';
|
|
18
|
+
export class StartupPipeline {
|
|
19
|
+
kernel = getKernel();
|
|
20
|
+
ai = new GeminiProvider();
|
|
21
|
+
memory = new LearningMemoryAgent(this.ai);
|
|
22
|
+
ideationAgent = new IdeationAgent(this.ai);
|
|
23
|
+
marketResearchAgent = new MarketResearchAgent(this.ai);
|
|
24
|
+
validationAgent = new ValidationAgent();
|
|
25
|
+
businessModelAgent = new BusinessModelAgent(this.ai);
|
|
26
|
+
productAgent = new ProductAgent(this.ai);
|
|
27
|
+
async run(seedIdea) {
|
|
28
|
+
const spinner = ora('Creating new venture...').start();
|
|
29
|
+
try {
|
|
30
|
+
// Step 1: Generate idea
|
|
31
|
+
spinner.text = 'Generating startup idea...';
|
|
32
|
+
const idea = await this.ideationAgent.generateIdea(seedIdea);
|
|
33
|
+
spinner.succeed('Startup idea generated');
|
|
34
|
+
// Step 2: Market research
|
|
35
|
+
spinner.start('Researching market...');
|
|
36
|
+
const market = await this.marketResearchAgent.researchMarket(idea);
|
|
37
|
+
spinner.succeed('Market research completed');
|
|
38
|
+
// Step 3: Create venture record
|
|
39
|
+
const ventureId = `venture_${randomUUID()}`;
|
|
40
|
+
const slug = seedIdea
|
|
41
|
+
.toLowerCase()
|
|
42
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
43
|
+
.replace(/^-|-$/g, '');
|
|
44
|
+
const venture = {
|
|
45
|
+
id: ventureId,
|
|
46
|
+
slug,
|
|
47
|
+
idea: seedIdea,
|
|
48
|
+
generatedIdea: idea,
|
|
49
|
+
market,
|
|
50
|
+
stage: 'ideation',
|
|
51
|
+
createdAt: new Date(),
|
|
52
|
+
updatedAt: new Date(),
|
|
53
|
+
metrics: {
|
|
54
|
+
mrr: 0,
|
|
55
|
+
cac: 0,
|
|
56
|
+
ltv: 0,
|
|
57
|
+
activationRate: 0,
|
|
58
|
+
retentionRate: 0,
|
|
59
|
+
growthRate: 0,
|
|
60
|
+
},
|
|
61
|
+
experimentIds: [],
|
|
62
|
+
};
|
|
63
|
+
// Step 4: Business model
|
|
64
|
+
spinner.start('Designing business model...');
|
|
65
|
+
const businessModel = await this.businessModelAgent.designBusinessModel(venture);
|
|
66
|
+
venture.businessModel = businessModel;
|
|
67
|
+
spinner.succeed('Business model designed');
|
|
68
|
+
// Step 5: Product MVP definition
|
|
69
|
+
spinner.start('Defining MVP...');
|
|
70
|
+
const mvp = await this.productAgent.defineMVP(venture);
|
|
71
|
+
spinner.succeed('MVP defined');
|
|
72
|
+
// Step 6: Create validation experiment
|
|
73
|
+
spinner.start('Creating validation experiment...');
|
|
74
|
+
const validationExperiment = await this.validationAgent.createValidationExperiment(venture);
|
|
75
|
+
spinner.succeed('Validation experiment created');
|
|
76
|
+
// Step 7: Create venture directory structure
|
|
77
|
+
spinner.start('Setting up venture structure...');
|
|
78
|
+
await this.setupVentureStructure(venture, mvp);
|
|
79
|
+
spinner.succeed('Venture structure created');
|
|
80
|
+
// Step 8: Save venture
|
|
81
|
+
await this.kernel.getStateStore().saveVenture(venture);
|
|
82
|
+
spinner.succeed(`Venture "${venture.idea}" created successfully!`);
|
|
83
|
+
console.log(chalk.green(`\nVenture ID: ${venture.id}`));
|
|
84
|
+
console.log(chalk.green(`Slug: ${venture.slug}`));
|
|
85
|
+
console.log(chalk.green(`Location: ventures/${venture.slug}`));
|
|
86
|
+
console.log(chalk.blue(`\nNext steps:`));
|
|
87
|
+
console.log(chalk.blue(`1. Run: basetree validate ${venture.id}`));
|
|
88
|
+
console.log(chalk.blue(`2. Review landing pages in ventures/${venture.slug}/landing`));
|
|
89
|
+
return venture;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
spinner.fail(`Failed to create venture: ${error.message}`);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async setupVentureStructure(venture, mvp) {
|
|
97
|
+
const venturePath = join('ventures', venture.slug);
|
|
98
|
+
// Create directory structure
|
|
99
|
+
await FileTools.writeFile(join(venturePath, 'package.json'), JSON.stringify({
|
|
100
|
+
name: venture.slug,
|
|
101
|
+
version: '0.1.0',
|
|
102
|
+
description: venture.idea,
|
|
103
|
+
main: 'src/index.js',
|
|
104
|
+
scripts: {
|
|
105
|
+
dev: 'node src/index.js',
|
|
106
|
+
build: 'echo "Build script"',
|
|
107
|
+
start: 'node src/index.js',
|
|
108
|
+
},
|
|
109
|
+
dependencies: {},
|
|
110
|
+
}, null, 2));
|
|
111
|
+
await FileTools.writeFile(join(venturePath, 'README.md'), `# ${venture.idea}
|
|
112
|
+
|
|
113
|
+
## Problem
|
|
114
|
+
${venture.generatedIdea.problem}
|
|
115
|
+
|
|
116
|
+
## Solution
|
|
117
|
+
${venture.generatedIdea.solution}
|
|
118
|
+
|
|
119
|
+
## Target Customer
|
|
120
|
+
${venture.generatedIdea.targetCustomer}
|
|
121
|
+
|
|
122
|
+
## MVP Features
|
|
123
|
+
${mvp.features.map((f) => `- ${f}`).join('\n')}
|
|
124
|
+
|
|
125
|
+
## Business Model
|
|
126
|
+
${venture.businessModel?.pricingModel || 'TBD'}
|
|
127
|
+
|
|
128
|
+
## Market
|
|
129
|
+
- TAM: $${venture.market?.tamEstimate.toLocaleString() || 'TBD'}
|
|
130
|
+
- SAM: $${venture.market?.samEstimate.toLocaleString() || 'TBD'}
|
|
131
|
+
- SOM: $${venture.market?.somEstimate.toLocaleString() || 'TBD'}
|
|
132
|
+
|
|
133
|
+
## Next Steps
|
|
134
|
+
1. Validate with landing page experiments
|
|
135
|
+
2. Build MVP
|
|
136
|
+
3. Launch and iterate
|
|
137
|
+
`);
|
|
138
|
+
// Create basic source structure
|
|
139
|
+
await FileTools.writeFile(join(venturePath, 'src', 'index.js'), `// ${venture.idea}
|
|
140
|
+
// MVP Implementation
|
|
141
|
+
|
|
142
|
+
console.log('${venture.idea} - Coming soon!');
|
|
143
|
+
`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate Pipeline for BASETREE V6
|
|
3
|
+
* Orchestrates validation experiments
|
|
4
|
+
*/
|
|
5
|
+
import { getKernel } from '../../kernel/kernel.js';
|
|
6
|
+
import { ValidationAgent } from '../../agents/venture/validationAgent.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import ora from 'ora';
|
|
9
|
+
export class ValidatePipeline {
|
|
10
|
+
kernel = getKernel();
|
|
11
|
+
validationAgent = new ValidationAgent();
|
|
12
|
+
async run(ventureId) {
|
|
13
|
+
const spinner = ora(`Validating venture ${ventureId}...`).start();
|
|
14
|
+
try {
|
|
15
|
+
const venture = await this.kernel.getStateStore().getVenture(ventureId);
|
|
16
|
+
if (!venture) {
|
|
17
|
+
throw new Error(`Venture ${ventureId} not found`);
|
|
18
|
+
}
|
|
19
|
+
spinner.text = 'Creating validation experiment...';
|
|
20
|
+
const experiment = await this.validationAgent.createValidationExperiment(venture);
|
|
21
|
+
spinner.succeed('Validation experiment created');
|
|
22
|
+
console.log(chalk.green(`\nExperiment ID: ${experiment.id}`));
|
|
23
|
+
console.log(chalk.green(`Variants: ${experiment.variants.length}`));
|
|
24
|
+
console.log(chalk.blue(`\nLanding pages created in: ventures/${venture.slug}/landing`));
|
|
25
|
+
console.log(chalk.blue(`\nTo test:`));
|
|
26
|
+
console.log(chalk.blue(`1. Open ventures/${venture.slug}/landing/variant-a.html`));
|
|
27
|
+
console.log(chalk.blue(`2. Open ventures/${venture.slug}/landing/variant-b.html`));
|
|
28
|
+
console.log(chalk.blue(`3. Track metrics and run: basetree launch ${ventureId}`));
|
|
29
|
+
// Update venture stage
|
|
30
|
+
await this.kernel.getStateStore().updateVenture(ventureId, {
|
|
31
|
+
stage: 'validation',
|
|
32
|
+
});
|
|
33
|
+
return experiment;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
spinner.fail(`Validation failed: ${error.message}`);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planetary Control Plane for BASETREE V7
|
|
3
|
+
* Central orchestrator for regions, organizations, and global policies
|
|
4
|
+
*/
|
|
5
|
+
import { randomUUID } from 'crypto';
|
|
6
|
+
import { getKernel } from '../kernel/kernel.js';
|
|
7
|
+
export class ControlPlane {
|
|
8
|
+
regionManager;
|
|
9
|
+
globalBus;
|
|
10
|
+
kernel = getKernel();
|
|
11
|
+
goals = new Map();
|
|
12
|
+
runs = new Map();
|
|
13
|
+
organizations = new Map();
|
|
14
|
+
constructor(regionManager, globalBus) {
|
|
15
|
+
this.regionManager = regionManager;
|
|
16
|
+
this.globalBus = globalBus;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Initialize control plane with default regions
|
|
20
|
+
*/
|
|
21
|
+
async initialize() {
|
|
22
|
+
// Register default regions for dev
|
|
23
|
+
this.regionManager.registerRegion({
|
|
24
|
+
id: 'us-east',
|
|
25
|
+
name: 'US East',
|
|
26
|
+
cloud: 'local',
|
|
27
|
+
locality: 'us-east',
|
|
28
|
+
capacity: {
|
|
29
|
+
maxConcurrentTasks: 100,
|
|
30
|
+
cpuUnits: 1000,
|
|
31
|
+
memoryGB: 100,
|
|
32
|
+
},
|
|
33
|
+
carbonIntensity: 0.5,
|
|
34
|
+
costPerHour: 1.0,
|
|
35
|
+
latency: {},
|
|
36
|
+
});
|
|
37
|
+
this.regionManager.registerRegion({
|
|
38
|
+
id: 'eu-west',
|
|
39
|
+
name: 'EU West',
|
|
40
|
+
cloud: 'local',
|
|
41
|
+
locality: 'eu-west',
|
|
42
|
+
capacity: {
|
|
43
|
+
maxConcurrentTasks: 100,
|
|
44
|
+
cpuUnits: 1000,
|
|
45
|
+
memoryGB: 100,
|
|
46
|
+
},
|
|
47
|
+
carbonIntensity: 0.3, // Lower carbon in EU
|
|
48
|
+
costPerHour: 1.2,
|
|
49
|
+
latency: {},
|
|
50
|
+
});
|
|
51
|
+
// Start default regions
|
|
52
|
+
await this.regionManager.startRegion('us-east');
|
|
53
|
+
await this.regionManager.startRegion('eu-west');
|
|
54
|
+
// Subscribe to global events
|
|
55
|
+
this.globalBus.subscribe('global.goal', async (event) => {
|
|
56
|
+
// Handle goal events
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Register an organization
|
|
61
|
+
*/
|
|
62
|
+
registerOrganization(org) {
|
|
63
|
+
this.organizations.set(org.id, org);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Submit a global goal
|
|
67
|
+
*/
|
|
68
|
+
async submitGoal(goal) {
|
|
69
|
+
// Validate organization if specified
|
|
70
|
+
if (goal.orgId) {
|
|
71
|
+
const org = this.organizations.get(goal.orgId);
|
|
72
|
+
if (!org) {
|
|
73
|
+
throw new Error(`Organization ${goal.orgId} not found`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Create run
|
|
77
|
+
const runId = `run_${randomUUID()}`;
|
|
78
|
+
const run = {
|
|
79
|
+
id: runId,
|
|
80
|
+
goalId: goal.id,
|
|
81
|
+
status: 'pending',
|
|
82
|
+
assignedRegions: [],
|
|
83
|
+
taskIds: [],
|
|
84
|
+
};
|
|
85
|
+
this.goals.set(goal.id, goal);
|
|
86
|
+
this.runs.set(runId, run);
|
|
87
|
+
// Publish goal to global bus
|
|
88
|
+
await this.globalBus.publish('global.goal', {
|
|
89
|
+
goal,
|
|
90
|
+
runId,
|
|
91
|
+
});
|
|
92
|
+
// Route to execution engine (will be implemented)
|
|
93
|
+
run.status = 'running';
|
|
94
|
+
run.startedAt = new Date();
|
|
95
|
+
return runId;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get run by ID
|
|
99
|
+
*/
|
|
100
|
+
getRun(runId) {
|
|
101
|
+
return this.runs.get(runId);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get goal by ID
|
|
105
|
+
*/
|
|
106
|
+
getGoal(goalId) {
|
|
107
|
+
return this.goals.get(goalId);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* List all runs
|
|
111
|
+
*/
|
|
112
|
+
listRuns(status) {
|
|
113
|
+
let runs = Array.from(this.runs.values());
|
|
114
|
+
if (status) {
|
|
115
|
+
runs = runs.filter((r) => r.status === status);
|
|
116
|
+
}
|
|
117
|
+
return runs;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get region manager
|
|
121
|
+
*/
|
|
122
|
+
getRegionManager() {
|
|
123
|
+
return this.regionManager;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get global bus
|
|
127
|
+
*/
|
|
128
|
+
getGlobalBus() {
|
|
129
|
+
return this.globalBus;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planetary Execution Engine for BASETREE V7
|
|
3
|
+
* Global task routing, multi-cloud orchestration, cost-aware and carbon-aware scheduling
|
|
4
|
+
*/
|
|
5
|
+
import { EconomicAgent } from '../agents/planet/economicAgent.js';
|
|
6
|
+
import { ClimateAgent } from '../agents/planet/climateAgent.js';
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
export class PlanetaryExecutionEngine {
|
|
9
|
+
controlPlane;
|
|
10
|
+
economicAgent;
|
|
11
|
+
climateAgent;
|
|
12
|
+
scheduledTasks = new Map();
|
|
13
|
+
constructor(controlPlane) {
|
|
14
|
+
this.controlPlane = controlPlane;
|
|
15
|
+
this.economicAgent = new EconomicAgent();
|
|
16
|
+
this.climateAgent = new ClimateAgent();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Submit a global task/goal
|
|
20
|
+
*/
|
|
21
|
+
async submitGlobalTask(goal) {
|
|
22
|
+
return this.controlPlane.submitGoal(goal);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Schedule a task to a region based on optimization criteria
|
|
26
|
+
*/
|
|
27
|
+
async scheduleTask(task) {
|
|
28
|
+
// Get available regions
|
|
29
|
+
const regionManager = this.controlPlane.getRegionManager();
|
|
30
|
+
const regions = regionManager.listRegions();
|
|
31
|
+
// Find optimal region based on:
|
|
32
|
+
// 1. Capacity
|
|
33
|
+
// 2. Cost
|
|
34
|
+
// 3. Carbon intensity
|
|
35
|
+
// 4. Latency (if dependencies exist)
|
|
36
|
+
const optimalRegion = await this.selectOptimalRegion(task, regions.map((r) => r.id));
|
|
37
|
+
const scheduledTask = {
|
|
38
|
+
...task,
|
|
39
|
+
assignedRegion: optimalRegion,
|
|
40
|
+
scheduledAt: new Date(),
|
|
41
|
+
status: 'scheduled',
|
|
42
|
+
};
|
|
43
|
+
this.scheduledTasks.set(task.id, scheduledTask);
|
|
44
|
+
// Route to regional kernel
|
|
45
|
+
const regionalKernel = regionManager.getRegion(optimalRegion);
|
|
46
|
+
if (regionalKernel) {
|
|
47
|
+
// In production, this would submit to regional execution queue
|
|
48
|
+
// For now, mark as running
|
|
49
|
+
scheduledTask.status = 'running';
|
|
50
|
+
scheduledTask.startedAt = new Date();
|
|
51
|
+
}
|
|
52
|
+
return scheduledTask;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Report task result
|
|
56
|
+
*/
|
|
57
|
+
async reportTaskResult(taskId, result, error) {
|
|
58
|
+
const task = this.scheduledTasks.get(taskId);
|
|
59
|
+
if (!task) {
|
|
60
|
+
throw new Error(`Task ${taskId} not found`);
|
|
61
|
+
}
|
|
62
|
+
if (error) {
|
|
63
|
+
task.status = 'failed';
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
task.status = 'completed';
|
|
67
|
+
task.result = result;
|
|
68
|
+
}
|
|
69
|
+
task.completedAt = new Date();
|
|
70
|
+
// If task failed, consider rescheduling to another region (self-healing)
|
|
71
|
+
if (error) {
|
|
72
|
+
await this.handleTaskFailure(task);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Select optimal region for a task
|
|
77
|
+
*/
|
|
78
|
+
async selectOptimalRegion(task, availableRegions) {
|
|
79
|
+
const regionManager = this.controlPlane.getRegionManager();
|
|
80
|
+
let bestRegion = availableRegions[0];
|
|
81
|
+
let bestScore = -Infinity;
|
|
82
|
+
for (const regionId of availableRegions) {
|
|
83
|
+
const config = regionManager.getRegionConfig(regionId);
|
|
84
|
+
if (!config)
|
|
85
|
+
continue;
|
|
86
|
+
// Check capacity
|
|
87
|
+
const regionalKernel = regionManager.getRegion(regionId);
|
|
88
|
+
if (!regionalKernel || regionalKernel.status !== 'healthy') {
|
|
89
|
+
continue; // Skip unhealthy regions
|
|
90
|
+
}
|
|
91
|
+
// Calculate score: balance cost, carbon, latency
|
|
92
|
+
const costScore = 1 / (config.costPerHour + 0.01); // Lower cost = higher score
|
|
93
|
+
const carbonScore = 1 / (config.carbonIntensity + 0.01); // Lower carbon = higher score
|
|
94
|
+
const capacityScore = config.capacity.maxConcurrentTasks / 100; // Normalized capacity
|
|
95
|
+
// Weighted combination
|
|
96
|
+
let score = costScore * 0.4 + carbonScore * 0.3 + capacityScore * 0.3;
|
|
97
|
+
// Apply constraints
|
|
98
|
+
if (task.constraints.preferredRegion && task.constraints.preferredRegion === regionId) {
|
|
99
|
+
score += 0.5; // Boost preferred region
|
|
100
|
+
}
|
|
101
|
+
if (score > bestScore) {
|
|
102
|
+
bestScore = score;
|
|
103
|
+
bestRegion = regionId;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return bestRegion;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Handle task failure with self-healing
|
|
110
|
+
*/
|
|
111
|
+
async handleTaskFailure(task) {
|
|
112
|
+
// Reschedule to a different region
|
|
113
|
+
const regionManager = this.controlPlane.getRegionManager();
|
|
114
|
+
const allRegions = regionManager.listRegions().map((r) => r.id);
|
|
115
|
+
const otherRegions = allRegions.filter((r) => r !== task.assignedRegion);
|
|
116
|
+
if (otherRegions.length > 0) {
|
|
117
|
+
console.warn(`Task ${task.id} failed in ${task.assignedRegion}, rescheduling to ${otherRegions[0]}`);
|
|
118
|
+
// Create new task descriptor
|
|
119
|
+
const newTask = {
|
|
120
|
+
...task,
|
|
121
|
+
id: `retry_${task.id}_${randomUUID()}`,
|
|
122
|
+
};
|
|
123
|
+
await this.scheduleTask(newTask);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get scheduled task
|
|
128
|
+
*/
|
|
129
|
+
getScheduledTask(taskId) {
|
|
130
|
+
return this.scheduledTasks.get(taskId);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* List scheduled tasks
|
|
134
|
+
*/
|
|
135
|
+
listScheduledTasks(status) {
|
|
136
|
+
let tasks = Array.from(this.scheduledTasks.values());
|
|
137
|
+
if (status) {
|
|
138
|
+
tasks = tasks.filter((t) => t.status === status);
|
|
139
|
+
}
|
|
140
|
+
return tasks;
|
|
141
|
+
}
|
|
142
|
+
}
|