moflo 4.8.33 → 4.8.35

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.
@@ -4,9 +4,6 @@
4
4
  *
5
5
  * Created with ❤️ by motailz.com
6
6
  */
7
- import { readFileSync } from 'fs';
8
- import { fileURLToPath } from 'url';
9
- import { dirname, join } from 'path';
10
7
  import { commandParser } from './parser.js';
11
8
  import { output } from './output.js';
12
9
  import { commands, commandsByCategory, getCommand, getCommandAsync, getCommandNames, hasCommand } from './commands/index.js';
@@ -14,21 +11,8 @@ import { suggestCommand } from './suggest.js';
14
11
  import { runStartupUpdateCheck } from './update/index.js';
15
12
  import { loadMofloConfig } from './config/moflo-config.js';
16
13
  import { getDaemonLockHolder } from './services/daemon-lock.js';
17
- // Read version from package.json at runtime
18
- function getPackageVersion() {
19
- try {
20
- const __filename = fileURLToPath(import.meta.url);
21
- const __dirname = dirname(__filename);
22
- // Navigate from dist/src to package root
23
- const pkgPath = join(__dirname, '..', '..', 'package.json');
24
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
25
- return pkg.version || '3.0.0';
26
- }
27
- catch {
28
- return '3.0.0';
29
- }
30
- }
31
- export const VERSION = getPackageVersion();
14
+ import { VERSION } from './version.js';
15
+ export { VERSION };
32
16
  const LONG_RUNNING_COMMANDS = ['mcp', 'daemon'];
33
17
  /**
34
18
  * V3 CLI Application
@@ -1676,6 +1676,22 @@ export const hooksSessionStart = {
1676
1676
  catch {
1677
1677
  // Bridge not available
1678
1678
  }
1679
+ // Auto-pretrain when intelligence is cold (no patterns restored)
1680
+ let pretrainResult = { ran: false };
1681
+ const restoredCount = sessionMemory?.restoredPatterns ?? 0;
1682
+ if (restoredCount === 0) {
1683
+ try {
1684
+ const result = await hooksPretrain.handler({
1685
+ path: process.cwd(),
1686
+ depth: 'shallow',
1687
+ });
1688
+ const stats = result?.stats;
1689
+ pretrainResult = { ran: true, patternsStored: stats?.patternsStored ?? 0 };
1690
+ }
1691
+ catch {
1692
+ pretrainResult = { ran: true, patternsStored: 0 };
1693
+ }
1694
+ }
1679
1695
  return {
1680
1696
  sessionId,
1681
1697
  started: new Date().toISOString(),
@@ -1688,6 +1704,7 @@ export const hooksSessionStart = {
1688
1704
  },
1689
1705
  daemon: daemonStatus,
1690
1706
  sessionMemory: sessionMemory || { controller: 'none', restoredPatterns: 0 },
1707
+ pretrain: pretrainResult,
1691
1708
  previousSession: restoreLatest ? {
1692
1709
  id: `session-${Date.now() - 86400000}`,
1693
1710
  tasksRestored: sessionMemory?.restoredPatterns || 3,
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Auto-generated by build. Do not edit manually.
3
+ * Source of truth: root package.json → scripts/sync-version.mjs
4
+ */
5
+ export const VERSION = '4.8.35';
6
+ //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.8.32",
3
+ "version": "4.8.35",
4
4
  "type": "module",
5
5
  "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -10,6 +10,14 @@
10
10
  * @module sona-integration
11
11
  */
12
12
  import { SonaEngine } from '@ruvector/sona';
13
+ // Default configs for when getModeConfig is unavailable (e.g., cold start, test environments)
14
+ const DEFAULT_MODE_CONFIGS = {
15
+ 'balanced': { mode: 'balanced', loraRank: 4, learningRate: 0.002, batchSize: 32, trajectoryCapacity: 3000, patternClusters: 50, qualityThreshold: 0.5, maxLatencyMs: 18, memoryBudgetMb: 50, ewcLambda: 2000 },
16
+ 'real-time': { mode: 'real-time', loraRank: 2, learningRate: 0.001, batchSize: 32, trajectoryCapacity: 1000, patternClusters: 25, qualityThreshold: 0.7, maxLatencyMs: 0.5, memoryBudgetMb: 25, ewcLambda: 2000 },
17
+ 'research': { mode: 'research', loraRank: 16, learningRate: 0.002, batchSize: 64, trajectoryCapacity: 10000, patternClusters: 100, qualityThreshold: 0.2, maxLatencyMs: 100, memoryBudgetMb: 100, ewcLambda: 2500 },
18
+ 'edge': { mode: 'edge', loraRank: 1, learningRate: 0.001, batchSize: 16, trajectoryCapacity: 200, patternClusters: 15, qualityThreshold: 0.8, maxLatencyMs: 1, memoryBudgetMb: 5, ewcLambda: 1500 },
19
+ 'batch': { mode: 'batch', loraRank: 8, learningRate: 0.002, batchSize: 128, trajectoryCapacity: 5000, patternClusters: 75, qualityThreshold: 0.4, maxLatencyMs: 50, memoryBudgetMb: 75, ewcLambda: 2000 },
20
+ };
13
21
  // =============================================================================
14
22
  // Mode Configuration Mapping
15
23
  // =============================================================================
@@ -311,6 +319,8 @@ export class SONALearningEngine {
311
319
  * @returns SONA learning engine instance
312
320
  */
313
321
  export function createSONALearningEngine(mode, modeConfig) {
314
- return new SONALearningEngine(mode, modeConfig);
322
+ const resolvedMode = mode ?? 'balanced';
323
+ const resolvedConfig = modeConfig ?? DEFAULT_MODE_CONFIGS[resolvedMode] ?? DEFAULT_MODE_CONFIGS['balanced'];
324
+ return new SONALearningEngine(resolvedMode, resolvedConfig);
315
325
  }
316
326
  //# sourceMappingURL=sona-integration.js.map