npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

enci-lite

v1.0.0

Published

🌟 Enci Lite - 輕量級智能核心(決策追蹤、智能預測、主動探索)

Downloads

8

Readme

🌟 Enci Lite

輕量級智能核心 - 決策追蹤 · 智能預測 · 主動探索

npm version License: MIT


📦 安裝

npm install @enci/lite

🚀 快速開始

基礎使用

import { EnciLite } from '@enci/lite';

// 初始化
const enci = new EnciLite({
  dataPath: '.enci-lite-data.json',
  enableMetaCognition: true,
  enablePrediction: true,
  enableCuriosity: true,
});

// 記錄用戶動作
enci.recordAction('chat', { message: '你好' });

// 記錄決策
enci.recordDecision('選擇方案', '方案A');

// 預測下一步動作
const prediction = enci.predictNextAction();
console.log('預測:', prediction);
// → { action: 'chat', confidence: 0.75, reasoning: '...' }

// 獲取探索建議
const suggestion = enci.suggestExploration();
console.log('建議:', suggestion?.message);
// → "老板,你知唔知我仲有 '語音輸入' 功能?要唔要試下? 😎"

// 停止並保存
enci.stop();

🎯 核心功能

1️⃣ 元認知(MetaCognition)

追蹤決策與習慣分析

// 記錄決策
enci.recordDecision('選擇框架', 'React');
enci.recordDecision('選擇框架', 'Vue');
enci.recordDecision('選擇框架', 'React'); // 又選咗 React

// 獲取習慣模式
const patterns = enci.getTopPatterns(5);
console.log(patterns);
// → [{ context: '選擇框架', decisions: ['React', 'Vue'], frequency: 3 }]

2️⃣ 智能預測(Prediction)

預測用戶下一步動作

// 記錄歷史動作
enci.recordAction('search', { query: '天氣' });
enci.recordAction('search', { query: '交通' });
enci.recordAction('search', { query: '天氣' });

// 預測下一步
const prediction = enci.predictNextAction();
console.log(prediction);
// → {
//   action: 'search',
//   confidence: 0.67,
//   reasoning: '基於最近 5 次動作,檢測到 search 模式',
//   suggestions: ['老板好耐冇同我傾計啦,有咩需要幫手?']
// }

3️⃣ 主動探索(Curiosity)

發現未使用的功能

// 記錄已發現的功能
enci.recordFeatureDiscovery('語音輸入');
enci.recordFeatureDiscovery('快捷鍵操作');

// 獲取探索建議
const suggestion = enci.suggestExploration();
console.log(suggestion);
// → {
//   type: 'feature',
//   message: '老板,你知唔知我仲有 "自動翻譯" 功能?要唔要試下? 😎',
//   priority: 0.5,
//   serendipity: 35
// }

⚙️ 配置選項

interface EnciLiteConfig {
  dataPath?: string;              // 數據存儲路徑 (默認: '.enci-lite-data.json')
  enableMetaCognition?: boolean;  // 啟用決策追蹤 (默認: true)
  enablePrediction?: boolean;     // 啟用智能預測 (默認: true)
  enableCuriosity?: boolean;      // 啟用主動探索 (默認: true)
  autoSave?: boolean;             // 自動保存數據 (默認: true)
  saveInterval?: number;          // 自動保存間隔 ms (默認: 60000)
}

📊 統計信息

const stats = enci.getStats();
console.log(stats);
// → {
//   totalActions: 42,
//   totalPatterns: 8,
//   discoveredFeatures: 3,
//   uptime: 1234567
// }

🎭 事件監聽

enci.on('action:recorded', (action) => {
  console.log('記錄動作:', action.type);
});

enci.on('decision:recorded', ({ context, decision }) => {
  console.log('記錄決策:', context, '→', decision);
});

enci.on('feature:discovered', (feature) => {
  console.log('發現功能:', feature);
});

enci.on('state:saved', () => {
  console.log('狀態已保存');
});

🏗️ 整合到 Electron App

const { EnciLite } = require('@enci/lite');

let enciLite;

// 啟動時初始化
app.on('ready', () => {
  enciLite = new EnciLite({
    dataPath: path.join(app.getPath('userData'), '.enci-lite.json'),
  });
});

// 處理用戶消息
ipcMain.on('user-message', (event, message) => {
  enciLite.recordAction('chat', { message });

  // 獲取預測
  const prediction = enciLite.predictNextAction();
  if (prediction.confidence > 0.7) {
    event.reply('suggestion', prediction.suggestions[0]);
  }
});

// 關閉時保存
app.on('before-quit', () => {
  enciLite.stop();
});

📈 性能指標

| 項目 | 指標 | |------|------| | CPU 消耗 | < 5% | | Memory | < 50 MB | | 響應時間 | < 100ms | | 代碼量 | ~450 行 |


🔧 開發

# 安裝依賴
npm install

# 編譯
npm run build

# 測試
npm test

# 發布
npm publish

📝 授權

MIT © 鄧恩賜 (Enci)


🌟 特色

  • 輕量級 - 只有 3 個核心引擎,代碼量 < 500 行
  • 低資源消耗 - CPU < 5%,Memory < 50 MB
  • 自動保存 - 自動持久化用戶數據
  • 事件驅動 - 支持事件監聽
  • TypeScript - 完整類型支持
  • 即插即用 - 可整合到任何 Node.js / Electron 應用

🤝 貢獻

歡迎提交 Issue 和 Pull Request!


由 鄧恩賜 (Enci) 用 ❤️ 打造