opc-agent 4.1.9 → 4.1.11

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/dist/cli.js CHANGED
@@ -1744,37 +1744,23 @@ const brainCmd = program
1744
1744
  .description('Manage agent brain (memory, seeds, evolve)');
1745
1745
  brainCmd
1746
1746
  .command('status')
1747
- .description('Show brain stats (pages, tiers, last evolve)')
1748
- .option('--url <url>', 'DeepBrain server URL', 'http://localhost:3333')
1749
- .action(async (opts) => {
1750
- console.log(`\n${icon.gear} ${color.bold('DeepBrain Status')} - ${color.dim(opts.url)}\n`);
1747
+ .description('Show brain stats (knowledge tiers, evolve history)')
1748
+ .action(async () => {
1749
+ console.log(`\n${icon.gear} ${color.bold('Knowledge Brain Status')}\n`);
1751
1750
  try {
1752
- const res = await fetch(`${opts.url}/api/stats`);
1753
- if (!res.ok)
1754
- throw new Error(`HTTP ${res.status} ${res.statusText}`);
1755
- const stats = (await res.json());
1756
- const rows = [
1757
- ['Total Pages', String(stats.totalPages ?? stats.pages ?? '-')],
1758
- ['Total Chunks', String(stats.totalChunks ?? stats.chunks ?? '-')],
1759
- ['Memory Tiers', String(stats.memoryTiers ?? stats.tiers ?? '-')],
1760
- ['Index Size', stats.indexSize ?? '-'],
1761
- ['Last Updated', stats.lastUpdated ?? stats.updatedAt ?? '-'],
1762
- ];
1763
- const maxKey = Math.max(...rows.map(([k]) => k.length));
1764
- for (const [key, val] of rows) {
1765
- console.log(` ${color.cyan(key.padEnd(maxKey))} ${val}`);
1766
- }
1751
+ const { KnowledgeEvolveEngine } = require('./memory/evolve-engine');
1752
+ const engine = new KnowledgeEvolveEngine(process.cwd());
1753
+ const model = await engine.detectLocalModel();
1754
+ const stats = engine.getStats();
1755
+ console.log(` ${color.cyan('Evolve Model'.padEnd(16))} ${model} (local, free)`);
1756
+ console.log(` ${color.cyan('Workstation'.padEnd(16))} ${stats.workstation} pages`);
1757
+ console.log(` ${color.cyan('Job'.padEnd(16))} ${stats.job} pages`);
1758
+ console.log(` ${color.cyan('Industry'.padEnd(16))} ${stats.industry} pages`);
1759
+ console.log(` ${color.cyan('Last Evolve'.padEnd(16))} ${stats.lastEvolve || 'never'}`);
1767
1760
  console.log();
1768
1761
  }
1769
- catch (err) {
1770
- const msg = err instanceof Error ? err.message : String(err);
1771
- if (msg.includes('ECONNREFUSED') || msg.includes('fetch failed')) {
1772
- console.log(` ${icon.warn} Cannot connect to DeepBrain at ${opts.url}`);
1773
- console.log(` ${color.dim('Is the server running? Start with: deepbrain serve')}\n`);
1774
- }
1775
- else {
1776
- console.error(` ${icon.error} ${msg}\n`);
1777
- }
1762
+ catch (e) {
1763
+ console.log(` ${icon.warn} ${e.message}\n`);
1778
1764
  }
1779
1765
  });
1780
1766
  brainCmd
@@ -1833,29 +1819,30 @@ brainCmd
1833
1819
  });
1834
1820
  brainCmd
1835
1821
  .command('evolve')
1836
- .description('Trigger manual knowledge evolution cycle')
1837
- .option('--dry-run', 'Show what would be promoted without doing it')
1822
+ .description('Trigger manual knowledge evolution cycle (uses local Ollama model)')
1823
+ .option('--dry-run', 'Show stats without evolving')
1838
1824
  .action(async (opts) => {
1839
- const { KnowledgeEvolver } = require('./memory/seed-loader');
1840
- const evolver = new KnowledgeEvolver();
1841
- console.log(`\n${icon.gear} ${color.bold('Knowledge Evolution')}\n`);
1842
- console.log(` ${icon.info} Checking for promotion candidates...`);
1843
- // Would connect to real brain in production
1844
- const result = await evolver.checkPromotion(null);
1845
- if (result.candidates.length === 0) {
1846
- console.log(` ${icon.info} No knowledge ready for promotion yet.\n`);
1825
+ const { KnowledgeEvolveEngine } = require('./memory/evolve-engine');
1826
+ const engine = new KnowledgeEvolveEngine(process.cwd());
1827
+ console.log(`\n${icon.gear} ${color.bold('Knowledge Evolution')} ${color.dim('(local Ollama model, zero cost)')}\n`);
1828
+ const model = await engine.detectLocalModel();
1829
+ console.log(` Model: ${color.cyan(model)}`);
1830
+ const stats = engine.getStats();
1831
+ console.log(` Knowledge pages: workstation=${stats.workstation} job=${stats.job} industry=${stats.industry}`);
1832
+ if (stats.lastEvolve)
1833
+ console.log(` Last evolve: ${stats.lastEvolve}`);
1834
+ if (opts.dryRun) {
1835
+ console.log(`\n ${icon.info} Dry run — no changes.\n`);
1836
+ return;
1847
1837
  }
1848
- else {
1849
- for (const c of result.candidates) {
1850
- console.log(` ${color.cyan(c.slug)} ${c.fromTier} ${c.toTier} (confidence: ${(c.confidence * 100).toFixed(0)}%)`);
1851
- }
1852
- if (opts.dryRun) {
1853
- console.log(`\n ${icon.info} Dry run - no changes made.\n`);
1854
- }
1855
- else {
1856
- console.log(`\n ${icon.success} Promoted ${result.promoted} knowledge entries.\n`);
1857
- }
1838
+ console.log(`\n ${icon.info} Running evolve cycle...`);
1839
+ const result = await engine.evolve();
1840
+ console.log(` ${icon.success} Extracted: ${result.extracted}, Deduplicated: ${result.deduplicated}, Promoted: ${result.promoted}`);
1841
+ if (result.errors.length > 0) {
1842
+ for (const e of result.errors)
1843
+ console.log(` ${icon.warn} ${e}`);
1858
1844
  }
1845
+ console.log();
1859
1846
  });
1860
1847
  // ── Logs command ─────────────────────────────────────────────
1861
1848
  program