@massu/core 1.12.0 → 1.12.2

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.
@@ -592,7 +592,7 @@ function getFeatureImpact(db, filePaths) {
592
592
  const affectedFeatureIds = /* @__PURE__ */ new Set();
593
593
  for (const filePath of filePaths) {
594
594
  const links = db.prepare(
595
- `SELECT feature_id FROM ${t("sentinel_components")} WHERE component_file = ?`
595
+ `SELECT feature_id FROM ${t("sentinel_components")} WHERE component_file = ? LIMIT 10000`
596
596
  ).all(filePath);
597
597
  for (const link of links) {
598
598
  affectedFeatureIds.add(link.feature_id);
@@ -605,7 +605,7 @@ function getFeatureImpact(db, filePaths) {
605
605
  const feature = getFeatureById(db, featureId);
606
606
  if (!feature || feature.status !== "active") continue;
607
607
  const allComponents = db.prepare(
608
- `SELECT component_file, is_primary FROM ${t("sentinel_components")} WHERE feature_id = ?`
608
+ `SELECT component_file, is_primary FROM ${t("sentinel_components")} WHERE feature_id = ? LIMIT 10000`
609
609
  ).all(featureId);
610
610
  const affected = allComponents.filter((c) => fileSet.has(c.component_file));
611
611
  const remaining = allComponents.filter((c) => !fileSet.has(c.component_file));
@@ -756,13 +756,13 @@ function runPreDeleteChecks(hookInput) {
756
756
  try {
757
757
  for (const pyFile of pyFiles) {
758
758
  const importers = db.prepare(
759
- `SELECT source_file FROM ${t("py_imports")} WHERE target_file = ?`
759
+ `SELECT source_file FROM ${t("py_imports")} WHERE target_file = ? LIMIT 10000`
760
760
  ).all(pyFile);
761
761
  const routes = db.prepare(
762
- `SELECT method, path FROM ${t("py_routes")} WHERE file = ?`
762
+ `SELECT method, path FROM ${t("py_routes")} WHERE file = ? LIMIT 10000`
763
763
  ).all(pyFile);
764
764
  const models = db.prepare(
765
- `SELECT class_name FROM ${t("py_models")} WHERE file = ?`
765
+ `SELECT class_name FROM ${t("py_models")} WHERE file = ? LIMIT 10000`
766
766
  ).all(pyFile);
767
767
  if (importers.length > 0 || routes.length > 0 || models.length > 0) {
768
768
  const parts = [];
@@ -724,7 +724,7 @@ function getFeatureImpact(db, filePaths) {
724
724
  const affectedFeatureIds = /* @__PURE__ */ new Set();
725
725
  for (const filePath of filePaths) {
726
726
  const links = db.prepare(
727
- `SELECT feature_id FROM ${t("sentinel_components")} WHERE component_file = ?`
727
+ `SELECT feature_id FROM ${t("sentinel_components")} WHERE component_file = ? LIMIT 10000`
728
728
  ).all(filePath);
729
729
  for (const link of links) {
730
730
  affectedFeatureIds.add(link.feature_id);
@@ -737,7 +737,7 @@ function getFeatureImpact(db, filePaths) {
737
737
  const feature = getFeatureById(db, featureId);
738
738
  if (!feature || feature.status !== "active") continue;
739
739
  const allComponents = db.prepare(
740
- `SELECT component_file, is_primary FROM ${t("sentinel_components")} WHERE feature_id = ?`
740
+ `SELECT component_file, is_primary FROM ${t("sentinel_components")} WHERE feature_id = ? LIMIT 10000`
741
741
  ).all(featureId);
742
742
  const affected = allComponents.filter((c) => fileSet.has(c.component_file));
743
743
  const remaining = allComponents.filter((c) => !fileSet.has(c.component_file));
@@ -883,13 +883,13 @@ function runPreDeleteChecks(hookInput) {
883
883
  try {
884
884
  for (const pyFile of pyFiles) {
885
885
  const importers = db.prepare(
886
- `SELECT source_file FROM ${t("py_imports")} WHERE target_file = ?`
886
+ `SELECT source_file FROM ${t("py_imports")} WHERE target_file = ? LIMIT 10000`
887
887
  ).all(pyFile);
888
888
  const routes = db.prepare(
889
- `SELECT method, path FROM ${t("py_routes")} WHERE file = ?`
889
+ `SELECT method, path FROM ${t("py_routes")} WHERE file = ? LIMIT 10000`
890
890
  ).all(pyFile);
891
891
  const models = db.prepare(
892
- `SELECT class_name FROM ${t("py_models")} WHERE file = ?`
892
+ `SELECT class_name FROM ${t("py_models")} WHERE file = ? LIMIT 10000`
893
893
  ).all(pyFile);
894
894
  if (importers.length > 0 || routes.length > 0 || models.length > 0) {
895
895
  const parts = [];
@@ -1067,7 +1067,7 @@ function enqueueSyncPayload(db, payload) {
1067
1067
  }
1068
1068
  function dequeuePendingSync(db, limit = 10) {
1069
1069
  const stale = db.prepare(
1070
- "SELECT id, retry_count, last_error FROM pending_sync WHERE retry_count >= 10"
1070
+ "SELECT id, retry_count, last_error FROM pending_sync WHERE retry_count >= 10 LIMIT 10000"
1071
1071
  ).all();
1072
1072
  if (stale.length > 0) {
1073
1073
  const ids = stale.map((s) => s.id);
@@ -1191,7 +1191,7 @@ function generateCurrentMd(db, sessionId) {
1191
1191
  const session = db.prepare("SELECT * FROM sessions WHERE session_id = ?").get(sessionId);
1192
1192
  if (!session) return "# Session State\n\nNo active session found.\n";
1193
1193
  const observations = db.prepare(
1194
- "SELECT * FROM observations WHERE session_id = ? ORDER BY created_at_epoch ASC"
1194
+ "SELECT * FROM observations WHERE session_id = ? ORDER BY created_at_epoch ASC LIMIT 10000"
1195
1195
  ).all(sessionId);
1196
1196
  const summary = db.prepare(
1197
1197
  "SELECT * FROM session_summaries WHERE session_id = ? ORDER BY created_at_epoch DESC LIMIT 1"
@@ -1632,7 +1632,7 @@ function calculateQualityScore(db, sessionId) {
1632
1632
  const weights = getWeights();
1633
1633
  const categories = getCategories();
1634
1634
  const observations = db.prepare(
1635
- "SELECT type, detail FROM observations WHERE session_id = ?"
1635
+ "SELECT type, detail FROM observations WHERE session_id = ? LIMIT 10000"
1636
1636
  ).all(sessionId);
1637
1637
  let score = 50;
1638
1638
  const breakdown = Object.fromEntries(
@@ -1674,6 +1674,7 @@ function backfillQualityScores(db) {
1674
1674
  FROM sessions s
1675
1675
  LEFT JOIN session_quality_scores q ON s.session_id = q.session_id
1676
1676
  WHERE q.session_id IS NULL
1677
+ LIMIT 100000
1677
1678
  `).all();
1678
1679
  let backfilled = 0;
1679
1680
  for (const session of sessions) {
@@ -1824,7 +1825,7 @@ function detectOutcome(followUpPrompts, assistantResponses) {
1824
1825
  }
1825
1826
  function analyzeSessionPrompts(db, sessionId) {
1826
1827
  const prompts = db.prepare(
1827
- "SELECT prompt_text, prompt_number FROM user_prompts WHERE session_id = ? ORDER BY prompt_number ASC"
1828
+ "SELECT prompt_text, prompt_number FROM user_prompts WHERE session_id = ? ORDER BY prompt_number ASC LIMIT 10000"
1828
1829
  ).all(sessionId);
1829
1830
  if (prompts.length === 0) return 0;
1830
1831
  let stored = 0;
@@ -1869,10 +1870,10 @@ async function main() {
1869
1870
  try {
1870
1871
  createSession(db, session_id);
1871
1872
  const observations = db.prepare(
1872
- "SELECT * FROM observations WHERE session_id = ? ORDER BY created_at_epoch ASC"
1873
+ "SELECT * FROM observations WHERE session_id = ? ORDER BY created_at_epoch ASC LIMIT 10000"
1873
1874
  ).all(session_id);
1874
1875
  const prompts = db.prepare(
1875
- "SELECT prompt_text FROM user_prompts WHERE session_id = ? ORDER BY prompt_number ASC"
1876
+ "SELECT prompt_text FROM user_prompts WHERE session_id = ? ORDER BY prompt_number ASC LIMIT 10000"
1876
1877
  ).all(session_id);
1877
1878
  const summary = buildSummaryFromObservations(observations, prompts);
1878
1879
  addSummary(db, session_id, summary);
@@ -9053,12 +9053,12 @@ function getFailedAttempts(db, query, limit = 20) {
9053
9053
  }
9054
9054
  function getCrossTaskProgress(db, taskId) {
9055
9055
  const sessions = db.prepare(`
9056
- SELECT session_id FROM sessions WHERE task_id = ?
9056
+ SELECT session_id FROM sessions WHERE task_id = ? LIMIT 10000
9057
9057
  `).all(taskId);
9058
9058
  const merged = {};
9059
9059
  for (const session of sessions) {
9060
9060
  const summaries = db.prepare(`
9061
- SELECT plan_progress FROM session_summaries WHERE session_id = ?
9061
+ SELECT plan_progress FROM session_summaries WHERE session_id = ? LIMIT 10000
9062
9062
  `).all(session.session_id);
9063
9063
  for (const summary of summaries) {
9064
9064
  try {
@@ -1172,7 +1172,7 @@ async function main() {
1172
1172
  try {
1173
1173
  const placeholders = fileRefs.map(() => "?").join(",");
1174
1174
  const matches = kdb.prepare(
1175
- `SELECT DISTINCT file_path FROM knowledge_documents WHERE file_path IN (${placeholders})`
1175
+ `SELECT DISTINCT file_path FROM knowledge_documents WHERE file_path IN (${placeholders}) LIMIT 10000`
1176
1176
  ).all(...fileRefs);
1177
1177
  if (matches.length > 0) {
1178
1178
  addObservation(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massu/core",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "type": "module",
5
5
  "description": "AI Engineering Governance MCP Server - Session memory, knowledge system, feature registry, code intelligence, rule enforcement, tiered tooling (12 free / 73 total), 59 workflow commands, 11 agents, 20+ patterns",
6
6
  "main": "./dist/cli.js",